class Twilio::REST::Api::V2010::AccountContext::OutgoingCallerIdList
Public Class Methods
Initialize the OutgoingCallerIdList
@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 OutgoingCallerId resource.
@return [OutgoingCallerIdList] OutgoingCallerIdList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/api/v2010/account/outgoing_caller_id.rb 22 def initialize(version, account_sid: nil) 23 super(version) 24 25 # Path Solution 26 @solution = {account_sid: account_sid} 27 @uri = "/Accounts/#{@solution[:account_sid]}/OutgoingCallerIds.json" 28 end
Public Instance Methods
When passed a block, yields OutgoingCallerIdInstance
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/outgoing_caller_id.rb 85 def each 86 limits = @version.read_limits 87 88 page = self.page(page_size: limits[:page_size], ) 89 90 @version.stream(page, 91 limit: limits[:limit], 92 page_limit: limits[:page_limit]).each {|x| yield x} 93 end
Retrieve a single page of OutgoingCallerIdInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of OutgoingCallerIdInstance
# File lib/twilio-ruby/rest/api/v2010/account/outgoing_caller_id.rb 125 def get_page(target_url) 126 response = @version.domain.request( 127 'GET', 128 target_url 129 ) 130 OutgoingCallerIdPage.new(@version, response, @solution) 131 end
Lists OutgoingCallerIdInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [String] phone_number The phone number of the OutgoingCallerId resources
to read.
@param [String] friendly_name The string that identifies the OutgoingCallerId
resources to read.
@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/outgoing_caller_id.rb 45 def list(phone_number: :unset, friendly_name: :unset, limit: nil, page_size: nil) 46 self.stream( 47 phone_number: phone_number, 48 friendly_name: friendly_name, 49 limit: limit, 50 page_size: page_size 51 ).entries 52 end
Retrieve a single page of OutgoingCallerIdInstance
records from the API. Request
is executed immediately. @param [String] phone_number The phone number of the OutgoingCallerId resources
to read.
@param [String] friendly_name The string that identifies the OutgoingCallerId
resources to read.
@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 OutgoingCallerIdInstance
# File lib/twilio-ruby/rest/api/v2010/account/outgoing_caller_id.rb 106 def page(phone_number: :unset, friendly_name: :unset, page_token: :unset, page_number: :unset, page_size: :unset) 107 params = Twilio::Values.of({ 108 'PhoneNumber' => phone_number, 109 'FriendlyName' => friendly_name, 110 'PageToken' => page_token, 111 'Page' => page_number, 112 'PageSize' => page_size, 113 }) 114 115 response = @version.page('GET', @uri, params: params) 116 117 OutgoingCallerIdPage.new(@version, response, @solution) 118 end
Streams OutgoingCallerIdInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [String] phone_number The phone number of the OutgoingCallerId resources
to read.
@param [String] friendly_name The string that identifies the OutgoingCallerId
resources to read.
@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/outgoing_caller_id.rb 69 def stream(phone_number: :unset, friendly_name: :unset, limit: nil, page_size: nil) 70 limits = @version.read_limits(limit, page_size) 71 72 page = self.page( 73 phone_number: phone_number, 74 friendly_name: friendly_name, 75 page_size: limits[:page_size], 76 ) 77 78 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 79 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/outgoing_caller_id.rb 135 def to_s 136 '#<Twilio.Api.V2010.OutgoingCallerIdList>' 137 end