Class: Twilio::REST::Api::V2010::AccountContext::UsagePageMetadata

Inherits:
PageMetadata
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/usage.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) ⇒ UsagePageMetadata

Returns a new instance of UsagePageMetadata.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/twilio-ruby/rest/api/v2010/account/usage.rb', line 100

def initialize(version, response, solution, limit)
    super(version, response)
    @usage_page = []
    @limit = limit
    key = get_key(response.body)
    records = 0
    while( limit != :unset && records < limit )
        @usage_page << UsageListResponse.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

#usage_pageObject (readonly)

Returns the value of attribute usage_page.



98
99
100
# File 'lib/twilio-ruby/rest/api/v2010/account/usage.rb', line 98

def usage_page
  @usage_page
end

Instance Method Details

#eachObject



116
117
118
119
120
# File 'lib/twilio-ruby/rest/api/v2010/account/usage.rb', line 116

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

#to_sObject



122
123
124
# File 'lib/twilio-ruby/rest/api/v2010/account/usage.rb', line 122

def to_s
  '<Twilio::REST::Api::V2010PageMetadata>';
end