class Twilio::REST::Api::V2010::AccountContext::ApplicationContext

Public Class Methods

new(version, account_sid, sid) click to toggle source

Initialize the ApplicationContext @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 to fetch.

@param [String] sid The Twilio-provided string that uniquely identifies the

Application resource to fetch.

@return [ApplicationContext] ApplicationContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/api/v2010/account/application.rb
222 def initialize(version, account_sid, sid)
223   super(version)
224 
225   # Path Solution
226   @solution = {account_sid: account_sid, sid: sid, }
227   @uri = "/Accounts/#{@solution[:account_sid]}/Applications/#{@solution[:sid]}.json"
228 end

Public Instance Methods

delete() click to toggle source

Delete the ApplicationInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/api/v2010/account/application.rb
233 def delete
234    @version.delete('DELETE', @uri)
235 end
fetch() click to toggle source

Fetch the ApplicationInstance @return [ApplicationInstance] Fetched ApplicationInstance

    # File lib/twilio-ruby/rest/api/v2010/account/application.rb
240 def fetch
241   payload = @version.fetch('GET', @uri)
242 
243   ApplicationInstance.new(
244       @version,
245       payload,
246       account_sid: @solution[:account_sid],
247       sid: @solution[:sid],
248   )
249 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/api/v2010/account/application.rb
325 def inspect
326   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
327   "#<Twilio.Api.V2010.ApplicationContext #{context}>"
328 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/api/v2010/account/application.rb
318 def to_s
319   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
320   "#<Twilio.Api.V2010.ApplicationContext #{context}>"
321 end
update(friendly_name: :unset, 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) click to toggle source

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

the resource. It can be up to 64 characters long.

@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 your 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 Same as message_status_callback: The URL we

should call using a POST method to send status information about SMS messages
sent by the application. Deprecated, included for backwards compatibility.

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

method to send message status information to your application.

@return [ApplicationInstance] Updated ApplicationInstance

    # File lib/twilio-ruby/rest/api/v2010/account/application.rb
287 def update(friendly_name: :unset, 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)
288   data = Twilio::Values.of({
289       'FriendlyName' => friendly_name,
290       'ApiVersion' => api_version,
291       'VoiceUrl' => voice_url,
292       'VoiceMethod' => voice_method,
293       'VoiceFallbackUrl' => voice_fallback_url,
294       'VoiceFallbackMethod' => voice_fallback_method,
295       'StatusCallback' => status_callback,
296       'StatusCallbackMethod' => status_callback_method,
297       'VoiceCallerIdLookup' => voice_caller_id_lookup,
298       'SmsUrl' => sms_url,
299       'SmsMethod' => sms_method,
300       'SmsFallbackUrl' => sms_fallback_url,
301       'SmsFallbackMethod' => sms_fallback_method,
302       'SmsStatusCallback' => sms_status_callback,
303       'MessageStatusCallback' => message_status_callback,
304   })
305 
306   payload = @version.update('POST', @uri, data: data)
307 
308   ApplicationInstance.new(
309       @version,
310       payload,
311       account_sid: @solution[:account_sid],
312       sid: @solution[:sid],
313   )
314 end