class Twilio::REST::Api::V2010::AccountContext::IncomingPhoneNumberContext::AssignedAddOnList
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Public Class Methods
Initialize the AssignedAddOnList
@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 resource.
@param [String] resource_sid The SID of the Phone Number to which the Add-on is
assigned.
@return [AssignedAddOnList] AssignedAddOnList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb 27 def initialize(version, account_sid: nil, resource_sid: nil) 28 super(version) 29 30 # Path Solution 31 @solution = {account_sid: account_sid, resource_sid: resource_sid} 32 @uri = "/Accounts/#{@solution[:account_sid]}/IncomingPhoneNumbers/#{@solution[:resource_sid]}/AssignedAddOns.json" 33 end
Public Instance Methods
Create the AssignedAddOnInstance
@param [String] installed_add_on_sid The SID that identifies the Add-on
installation.
@return [AssignedAddOnInstance] Created AssignedAddOnInstance
# File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb 120 def create(installed_add_on_sid: nil) 121 data = Twilio::Values.of({'InstalledAddOnSid' => installed_add_on_sid, }) 122 123 payload = @version.create('POST', @uri, data: data) 124 125 AssignedAddOnInstance.new( 126 @version, 127 payload, 128 account_sid: @solution[:account_sid], 129 resource_sid: @solution[:resource_sid], 130 ) 131 end
When passed a block, yields AssignedAddOnInstance
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/incoming_phone_number/assigned_add_on.rb 73 def each 74 limits = @version.read_limits 75 76 page = self.page(page_size: limits[:page_size], ) 77 78 @version.stream(page, 79 limit: limits[:limit], 80 page_limit: limits[:page_limit]).each {|x| yield x} 81 end
Retrieve a single page of AssignedAddOnInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of AssignedAddOnInstance
# File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb 107 def get_page(target_url) 108 response = @version.domain.request( 109 'GET', 110 target_url 111 ) 112 AssignedAddOnPage.new(@version, response, @solution) 113 end
Lists AssignedAddOnInstance
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/incoming_phone_number/assigned_add_on.rb 46 def list(limit: nil, page_size: nil) 47 self.stream(limit: limit, page_size: page_size).entries 48 end
Retrieve a single page of AssignedAddOnInstance
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 AssignedAddOnInstance
# File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb 90 def page(page_token: :unset, page_number: :unset, page_size: :unset) 91 params = Twilio::Values.of({ 92 'PageToken' => page_token, 93 'Page' => page_number, 94 'PageSize' => page_size, 95 }) 96 97 response = @version.page('GET', @uri, params: params) 98 99 AssignedAddOnPage.new(@version, response, @solution) 100 end
Streams AssignedAddOnInstance
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/incoming_phone_number/assigned_add_on.rb 61 def stream(limit: nil, page_size: nil) 62 limits = @version.read_limits(limit, page_size) 63 64 page = self.page(page_size: limits[:page_size], ) 65 66 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 67 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb 135 def to_s 136 '#<Twilio.Api.V2010.AssignedAddOnList>' 137 end