Class: Sendly::ConversationWithMessages
- Inherits:
-
Conversation
- Object
- Conversation
- Sendly::ConversationWithMessages
- Defined in:
- lib/sendly/types.rb
Constant Summary
Constants inherited from Conversation
Sendly::Conversation::STATUSES
Instance Attribute Summary collapse
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
Attributes inherited from Conversation
#contact_id, #created_at, #id, #last_message_at, #last_message_direction, #last_message_text, #message_count, #metadata, #phone_number, #status, #tags, #unread_count, #updated_at
Instance Method Summary collapse
-
#initialize(data) ⇒ ConversationWithMessages
constructor
A new instance of ConversationWithMessages.
Methods inherited from Conversation
Constructor Details
#initialize(data) ⇒ ConversationWithMessages
Returns a new instance of ConversationWithMessages.
733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 |
# File 'lib/sendly/types.rb', line 733 def initialize(data) super(data) if data["messages"] msgs = data["messages"] @messages = { data: (msgs["data"] || []).map { |m| Message.new(m) }, pagination: { total: msgs.dig("pagination", "total") || 0, limit: msgs.dig("pagination", "limit") || 20, offset: msgs.dig("pagination", "offset") || 0, has_more: msgs.dig("pagination", "hasMore") || msgs.dig("pagination", "has_more") || false } } end end |
Instance Attribute Details
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
731 732 733 |
# File 'lib/sendly/types.rb', line 731 def @messages end |