Class: Twilio::REST::Conversations::V2::ConversationPageMetadata

Inherits:
PageMetadata
  • Object
show all
Defined in:
lib/twilio-ruby/rest/conversations/v2/conversation.rb

Constant Summary

Constants inherited from PageMetadata

PageMetadata::META_KEYS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from PageMetadata

#get_key, #next_page, #next_page_url, #previous_page, #previous_page_url, #process_response

Constructor Details

#initialize(version, response, solution, limit) ⇒ ConversationPageMetadata

Returns a new instance of ConversationPageMetadata.



1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
# File 'lib/twilio-ruby/rest/conversations/v2/conversation.rb', line 1337

def initialize(version, response, solution, limit)
    super(version, response)
    @conversation_page = []
    @limit = limit
    key = get_key(response.body)
    records = 0
    while( limit != :unset && records < limit )
        @conversation_page << ConversationListResponse.new(version, @payload, key, limit - records)
        @payload = self.next_page
        break unless @payload
        records += (@payload.body[key] || []).size
    end
    # Path Solution
    @solution = solution
end

Instance Attribute Details

#conversation_page ⇒ Object (readonly)

Returns the value of attribute conversation_page.



1335
1336
1337
# File 'lib/twilio-ruby/rest/conversations/v2/conversation.rb', line 1335

def conversation_page
  @conversation_page
end

Instance Method Details

#each ⇒ Object



1353
1354
1355
1356
1357
# File 'lib/twilio-ruby/rest/conversations/v2/conversation.rb', line 1353

def each
    @conversation_page.each do |record|
      yield record
    end
end

#to_s ⇒ Object



1359
1360
1361
# File 'lib/twilio-ruby/rest/conversations/v2/conversation.rb', line 1359

def to_s
  '<Twilio::REST::Conversations::V2PageMetadata>';
end