Class: Sendly::ConversationList
- Inherits:
-
Object
- Object
- Sendly::ConversationList
- Includes:
- Enumerable
- Defined in:
- lib/sendly/types.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#has_more ⇒ Object
readonly
Returns the value of attribute has_more.
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #count ⇒ Object (also: #size, #length)
- #each(&block) ⇒ Object
- #empty? ⇒ Boolean
- #first ⇒ Object
-
#initialize(response) ⇒ ConversationList
constructor
A new instance of ConversationList.
- #last ⇒ Object
Constructor Details
#initialize(response) ⇒ ConversationList
Returns a new instance of ConversationList.
566 567 568 569 570 571 572 573 |
# File 'lib/sendly/types.rb', line 566 def initialize(response) @data = (response["data"] || []).map { |c| Conversation.new(c) } pagination = response["pagination"] || {} @total = pagination["total"] || @data.length @limit = pagination["limit"] || 20 @offset = pagination["offset"] || 0 @has_more = pagination["hasMore"] || pagination["has_more"] || false end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
564 565 566 |
# File 'lib/sendly/types.rb', line 564 def data @data end |
#has_more ⇒ Object (readonly)
Returns the value of attribute has_more.
564 565 566 |
# File 'lib/sendly/types.rb', line 564 def has_more @has_more end |
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
564 565 566 |
# File 'lib/sendly/types.rb', line 564 def limit @limit end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
564 565 566 |
# File 'lib/sendly/types.rb', line 564 def offset @offset end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
564 565 566 |
# File 'lib/sendly/types.rb', line 564 def total @total end |
Instance Method Details
#count ⇒ Object Also known as: size, length
579 580 581 |
# File 'lib/sendly/types.rb', line 579 def count data.length end |
#each(&block) ⇒ Object
575 576 577 |
# File 'lib/sendly/types.rb', line 575 def each(&block) data.each(&block) end |
#empty? ⇒ Boolean
586 587 588 |
# File 'lib/sendly/types.rb', line 586 def empty? data.empty? end |
#first ⇒ Object
590 591 592 |
# File 'lib/sendly/types.rb', line 590 def first data.first end |
#last ⇒ Object
594 595 596 |
# File 'lib/sendly/types.rb', line 594 def last data.last end |