class Twilio::REST::Api::V2010::AccountContext::ApplicationList

Public Class Methods

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

Initialize the ApplicationList @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
Application resource.

@return [ApplicationList] ApplicationList

Calls superclass method Twilio::REST::ListResource::new
   # File lib/twilio-ruby/rest/api/v2010/account/application.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]}/Applications.json"
28 end

Public Instance Methods

create(api_version: :unset, voice_url: :unset, voice_method: :unset, voice_fallback_url: :unset, voice_fallback_method: :unset, status_callback: :unset, status_callback_method: :unset, voice_caller_id_lookup: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset, sms_status_callback: :unset, message_status_callback: :unset, friendly_name: :unset) click to toggle source

Create the ApplicationInstance @param [String] api_version The API version to use to start a new TwiML session.

Can be: `2010-04-01` or `2008-08-01`. The default value is the account's default
API version.

@param [String] voice_url The URL we should call when the phone number assigned

to this application receives a call.

@param [String] voice_method The HTTP method we should use to call `voice_url`.

Can be: `GET` or `POST`.

@param [String] voice_fallback_url The URL that we should call when an error

occurs retrieving or executing the TwiML requested by `url`.

@param [String] voice_fallback_method The HTTP method we should use to call

`voice_fallback_url`. Can be: `GET` or `POST`.

@param [String] status_callback The URL we should call using the

`status_callback_method` to send status information to your application.

@param [String] status_callback_method The HTTP method we should use to call

`status_callback`. Can be: `GET` or `POST`.

@param [Boolean] voice_caller_id_lookup Whether we should look up the caller's

caller-ID name from the CNAM database (additional charges apply). Can be: `true`
or `false`.

@param [String] sms_url The URL we should call when the phone number receives an

incoming SMS message.

@param [String] sms_method The HTTP method we should use to call `sms_url`. Can

be: `GET` or `POST`.

@param [String] sms_fallback_url The URL that we should call when an error

occurs while retrieving or executing the TwiML from `sms_url`.

@param [String] sms_fallback_method The HTTP method we should use to call

`sms_fallback_url`. Can be: `GET` or `POST`.

@param [String] sms_status_callback The URL we should call using a POST method

to send status information about SMS messages sent by the application.

@param [String] message_status_callback The URL we should call using a POST

method to send message status information to your application.

@param [String] friendly_name A descriptive string that you create to describe

the new application. It can be up to 64 characters long.

@return [ApplicationInstance] Created ApplicationInstance

   # File lib/twilio-ruby/rest/api/v2010/account/application.rb
65 def create(api_version: :unset, voice_url: :unset, voice_method: :unset, voice_fallback_url: :unset, voice_fallback_method: :unset, status_callback: :unset, status_callback_method: :unset, voice_caller_id_lookup: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset, sms_status_callback: :unset, message_status_callback: :unset, friendly_name: :unset)
66   data = Twilio::Values.of({
67       'ApiVersion' => api_version,
68       'VoiceUrl' => voice_url,
69       'VoiceMethod' => voice_method,
70       'VoiceFallbackUrl' => voice_fallback_url,
71       'VoiceFallbackMethod' => voice_fallback_method,
72       'StatusCallback' => status_callback,
73       'StatusCallbackMethod' => status_callback_method,
74       'VoiceCallerIdLookup' => voice_caller_id_lookup,
75       'SmsUrl' => sms_url,
76       'SmsMethod' => sms_method,
77       'SmsFallbackUrl' => sms_fallback_url,
78       'SmsFallbackMethod' => sms_fallback_method,
79       'SmsStatusCallback' => sms_status_callback,
80       'MessageStatusCallback' => message_status_callback,
81       'FriendlyName' => friendly_name,
82   })
83 
84   payload = @version.create('POST', @uri, data: data)
85 
86   ApplicationInstance.new(@version, payload, account_sid: @solution[:account_sid], )
87 end
each() { |x| ... } click to toggle source

When passed a block, yields ApplicationInstance 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/application.rb
131 def each
132   limits = @version.read_limits
133 
134   page = self.page(page_size: limits[:page_size], )
135 
136   @version.stream(page,
137                   limit: limits[:limit],
138                   page_limit: limits[:page_limit]).each {|x| yield x}
139 end
get_page(target_url) click to toggle source

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

    # File lib/twilio-ruby/rest/api/v2010/account/application.rb
168 def get_page(target_url)
169   response = @version.domain.request(
170       'GET',
171       target_url
172   )
173   ApplicationPage.new(@version, response, @solution)
174 end
list(friendly_name: :unset, limit: nil, page_size: nil) click to toggle source

Lists ApplicationInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [String] friendly_name The string that identifies the Application

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/application.rb
102 def list(friendly_name: :unset, limit: nil, page_size: nil)
103   self.stream(friendly_name: friendly_name, limit: limit, page_size: page_size).entries
104 end
page(friendly_name: :unset, page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

Retrieve a single page of ApplicationInstance records from the API. Request is executed immediately. @param [String] friendly_name The string that identifies the Application

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 ApplicationInstance

    # File lib/twilio-ruby/rest/api/v2010/account/application.rb
150 def page(friendly_name: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
151   params = Twilio::Values.of({
152       'FriendlyName' => friendly_name,
153       'PageToken' => page_token,
154       'Page' => page_number,
155       'PageSize' => page_size,
156   })
157 
158   response = @version.page('GET', @uri, params: params)
159 
160   ApplicationPage.new(@version, response, @solution)
161 end
stream(friendly_name: :unset, limit: nil, page_size: nil) click to toggle source

Streams ApplicationInstance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [String] friendly_name The string that identifies the Application

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/application.rb
119 def stream(friendly_name: :unset, limit: nil, page_size: nil)
120   limits = @version.read_limits(limit, page_size)
121 
122   page = self.page(friendly_name: friendly_name, page_size: limits[:page_size], )
123 
124   @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
125 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/api/v2010/account/application.rb
178 def to_s
179   '#<Twilio.Api.V2010.ApplicationList>'
180 end