class Twilio::REST::Api::V2010::AccountContext::RecordingContext::AddOnResultContext::PayloadList

Public Class Methods

new(version, account_sid: nil, reference_sid: nil, add_on_result_sid: nil) click to toggle source

Initialize the PayloadList @param [Version] version Version that contains the resource @param [String] account_sid The SID of the

{Account}[https://www.twilio.com/docs/iam/api/account] that created the
Recording AddOnResult Payload resource.

@param [String] reference_sid The SID of the recording to which the AddOnResult

resource that contains the payload belongs.

@param [String] add_on_result_sid The SID of the AddOnResult to which the

payload belongs.

@return [PayloadList] PayloadList

Calls superclass method Twilio::REST::ListResource::new
   # File lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result/payload.rb
28 def initialize(version, account_sid: nil, reference_sid: nil, add_on_result_sid: nil)
29   super(version)
30 
31   # Path Solution
32   @solution = {
33       account_sid: account_sid,
34       reference_sid: reference_sid,
35       add_on_result_sid: add_on_result_sid
36   }
37   @uri = "/Accounts/#{@solution[:account_sid]}/Recordings/#{@solution[:reference_sid]}/AddOnResults/#{@solution[:add_on_result_sid]}/Payloads.json"
38 end

Public Instance Methods

each() { |x| ... } click to toggle source

When passed a block, yields PayloadInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.

   # File lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result/payload.rb
78 def each
79   limits = @version.read_limits
80 
81   page = self.page(page_size: limits[:page_size], )
82 
83   @version.stream(page,
84                   limit: limits[:limit],
85                   page_limit: limits[:page_limit]).each {|x| yield x}
86 end
get_page(target_url) click to toggle source

Retrieve a single page of PayloadInstance records from the API. Request is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page of PayloadInstance

    # File lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result/payload.rb
112 def get_page(target_url)
113   response = @version.domain.request(
114       'GET',
115       target_url
116   )
117   PayloadPage.new(@version, response, @solution)
118 end
list(limit: nil, page_size: nil) click to toggle source

Lists PayloadInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [Integer] limit Upper limit for the number of records to return. stream()

guarantees to never return more than limit.  Default is no limit

@param [Integer] page_size Number of records to fetch per request, when

not set will use the default value of 50 records.  If no page_size is defined
but a limit is defined, stream() will attempt to read the limit with the most
efficient page size, i.e. min(limit, 1000)

@return [Array] Array of up to limit results

   # File lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result/payload.rb
51 def list(limit: nil, page_size: nil)
52   self.stream(limit: limit, page_size: page_size).entries
53 end
page(page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

Retrieve a single page of PayloadInstance records from the API. Request is executed immediately. @param [String] page_token PageToken provided by the API @param [Integer] page_number Page Number, this value is simply for client state @param [Integer] page_size Number of records to return, defaults to 50 @return [Page] Page of PayloadInstance

    # File lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result/payload.rb
 95 def page(page_token: :unset, page_number: :unset, page_size: :unset)
 96   params = Twilio::Values.of({
 97       'PageToken' => page_token,
 98       'Page' => page_number,
 99       'PageSize' => page_size,
100   })
101 
102   response = @version.page('GET', @uri, params: params)
103 
104   PayloadPage.new(@version, response, @solution)
105 end
stream(limit: nil, page_size: nil) click to toggle source

Streams PayloadInstance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [Integer] limit Upper limit for the number of records to return. stream()

guarantees to never return more than limit. Default is no limit.

@param [Integer] page_size Number of records to fetch per request, when

not set will use the default value of 50 records. If no page_size is defined
but a limit is defined, stream() will attempt to read the limit with the most
efficient page size, i.e. min(limit, 1000)

@return [Enumerable] Enumerable that will yield up to limit results

   # File lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result/payload.rb
66 def stream(limit: nil, page_size: nil)
67   limits = @version.read_limits(limit, page_size)
68 
69   page = self.page(page_size: limits[:page_size], )
70 
71   @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
72 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result/payload.rb
122 def to_s
123   '#<Twilio.Api.V2010.PayloadList>'
124 end