class Twilio::REST::Preview::Marketplace::InstalledAddOnList

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.

Public Class Methods

new(version) click to toggle source

Initialize the InstalledAddOnList @param [Version] version Version that contains the resource @return [InstalledAddOnList] InstalledAddOnList

Calls superclass method Twilio::REST::ListResource::new
   # File lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb
20 def initialize(version)
21   super(version)
22 
23   # Path Solution
24   @solution = {}
25   @uri = "/InstalledAddOns"
26 end

Public Instance Methods

create(available_add_on_sid: nil, accept_terms_of_service: nil, configuration: :unset, unique_name: :unset) click to toggle source

Create the InstalledAddOnInstance @param [String] available_add_on_sid The SID of the AvaliableAddOn to install. @param [Boolean] accept_terms_of_service Whether the Terms of Service were

accepted.

@param [Hash] configuration The JSON object that represents the configuration of

the new Add-on being installed.

@param [String] unique_name An application-defined string that uniquely

identifies the resource. This value must be unique within the Account.

@return [InstalledAddOnInstance] Created InstalledAddOnInstance

   # File lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb
38 def create(available_add_on_sid: nil, accept_terms_of_service: nil, configuration: :unset, unique_name: :unset)
39   data = Twilio::Values.of({
40       'AvailableAddOnSid' => available_add_on_sid,
41       'AcceptTermsOfService' => accept_terms_of_service,
42       'Configuration' => Twilio.serialize_object(configuration),
43       'UniqueName' => unique_name,
44   })
45 
46   payload = @version.create('POST', @uri, data: data)
47 
48   InstalledAddOnInstance.new(@version, payload, )
49 end
each() { |x| ... } click to toggle source

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

   # File lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb
89 def each
90   limits = @version.read_limits
91 
92   page = self.page(page_size: limits[:page_size], )
93 
94   @version.stream(page,
95                   limit: limits[:limit],
96                   page_limit: limits[:page_limit]).each {|x| yield x}
97 end
get_page(target_url) click to toggle source

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

    # File lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb
123 def get_page(target_url)
124   response = @version.domain.request(
125       'GET',
126       target_url
127   )
128   InstalledAddOnPage.new(@version, response, @solution)
129 end
list(limit: nil, page_size: nil) click to toggle source

Lists InstalledAddOnInstance 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/preview/marketplace/installed_add_on.rb
62 def list(limit: nil, page_size: nil)
63   self.stream(limit: limit, page_size: page_size).entries
64 end
page(page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

Retrieve a single page of InstalledAddOnInstance 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 InstalledAddOnInstance

    # File lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb
106 def page(page_token: :unset, page_number: :unset, page_size: :unset)
107   params = Twilio::Values.of({
108       'PageToken' => page_token,
109       'Page' => page_number,
110       'PageSize' => page_size,
111   })
112 
113   response = @version.page('GET', @uri, params: params)
114 
115   InstalledAddOnPage.new(@version, response, @solution)
116 end
stream(limit: nil, page_size: nil) click to toggle source

Streams InstalledAddOnInstance 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/preview/marketplace/installed_add_on.rb
77 def stream(limit: nil, page_size: nil)
78   limits = @version.read_limits(limit, page_size)
79 
80   page = self.page(page_size: limits[:page_size], )
81 
82   @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
83 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb
133 def to_s
134   '#<Twilio.Preview.Marketplace.InstalledAddOnList>'
135 end