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.
645 646 647 648 649 650 651 652 |
# File 'lib/sendly/types.rb', line 645 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.
643 644 645 |
# File 'lib/sendly/types.rb', line 643 def data @data end |
#has_more ⇒ Object (readonly)
Returns the value of attribute has_more.
643 644 645 |
# File 'lib/sendly/types.rb', line 643 def has_more @has_more end |
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
643 644 645 |
# File 'lib/sendly/types.rb', line 643 def limit @limit end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
643 644 645 |
# File 'lib/sendly/types.rb', line 643 def offset @offset end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
643 644 645 |
# File 'lib/sendly/types.rb', line 643 def total @total end |
Instance Method Details
#count ⇒ Object Also known as: size, length
658 659 660 |
# File 'lib/sendly/types.rb', line 658 def count data.length end |
#each(&block) ⇒ Object
654 655 656 |
# File 'lib/sendly/types.rb', line 654 def each(&block) data.each(&block) end |
#empty? ⇒ Boolean
665 666 667 |
# File 'lib/sendly/types.rb', line 665 def empty? data.empty? end |
#first ⇒ Object
669 670 671 |
# File 'lib/sendly/types.rb', line 669 def first data.first end |
#last ⇒ Object
673 674 675 |
# File 'lib/sendly/types.rb', line 673 def last data.last end |