2020-12-02 23:22:51 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class REST::ChatMessageSerializer < ActiveModel::Serializer
|
2020-12-03 22:27:09 -05:00
|
|
|
attributes :id, :text_html, :text, :language, :from_account_id,
|
2020-12-15 19:31:30 -05:00
|
|
|
:chat_conversation_id, :created_at, :expires_at
|
2020-12-02 23:22:51 -05:00
|
|
|
|
|
|
|
def id
|
|
|
|
object.id.to_s
|
|
|
|
end
|
2020-12-03 17:13:11 -05:00
|
|
|
|
2020-12-03 22:27:09 -05:00
|
|
|
def text_html
|
|
|
|
Formatter.instance.chatMessageText(object).strip
|
|
|
|
end
|
|
|
|
|
2020-12-03 17:13:11 -05:00
|
|
|
def from_account_id
|
|
|
|
object.from_account_id.to_s
|
|
|
|
end
|
|
|
|
|
|
|
|
def chat_conversation_id
|
|
|
|
object.chat_conversation_id.to_s
|
|
|
|
end
|
|
|
|
|
2020-12-02 23:22:51 -05:00
|
|
|
end
|