Class: Twilio::REST::Api::V2010::AccountContext::ApplicationContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/application.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, sid) ⇒ ApplicationContext

Initialize the ApplicationContext

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String)

    The account_sid

  • sid (String)

    The application Sid that that uniquely identifies this resource



225
226
227
228
229
230
231
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 225

def initialize(version, , sid)
  super(version)

  # Path Solution
  @solution = {account_sid: , sid: sid, }
  @uri = "/Accounts/#{@solution[:account_sid]}/Applications/#{@solution[:sid]}.json"
end

Instance Method Details

#deleteBoolean

Deletes the ApplicationInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



236
237
238
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 236

def delete
  @version.delete('delete', @uri)
end

#fetchApplicationInstance

Fetch a ApplicationInstance

Returns:



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 243

def fetch
  params = Twilio::Values.of({})

  payload = @version.fetch(
      'GET',
      @uri,
      params,
  )

  ApplicationInstance.new(
      @version,
      payload,
      account_sid: @solution[:account_sid],
      sid: @solution[:sid],
  )
end

#to_sObject

Provide a user friendly representation



331
332
333
334
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 331

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Api.V2010.ApplicationContext #{context}>"
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) ⇒ ApplicationInstance

Update the ApplicationInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)

    A human readable descriptive text for this resource, up to 64 characters long.

  • api_version (String) (defaults to: :unset)

    Requests to this application will start a new TwiML session with this API version.

  • voice_url (String) (defaults to: :unset)

    The URL Twilio will request when a phone number assigned to this application receives a call.

  • voice_method (String) (defaults to: :unset)

    The HTTP method Twilio will use when requesting the above ‘Url`. Either `GET` or `POST`.

  • voice_fallback_url (String) (defaults to: :unset)

    The URL that Twilio will request if an error occurs retrieving or executing the TwiML requested by ‘Url`.

  • voice_fallback_method (String) (defaults to: :unset)

    The HTTP method Twilio will use when requesting the ‘VoiceFallbackUrl`. Either `GET` or `POST`.

  • status_callback (String) (defaults to: :unset)

    The URL that Twilio will request to pass status parameters (such as call ended) to your application.

  • status_callback_method (String) (defaults to: :unset)

    The HTTP method Twilio will use to make requests to the ‘StatusCallback` URL. Either `GET` or `POST`.

  • voice_caller_id_lookup (Boolean) (defaults to: :unset)

    Look up the caller’s caller-ID name from the CNAM database (additional charges apply). Either ‘true` or `false`.

  • sms_url (String) (defaults to: :unset)

    The URL Twilio will request when a phone number assigned to this application receives an incoming SMS message.

  • sms_method (String) (defaults to: :unset)

    The HTTP method Twilio will use when making requests to the ‘SmsUrl`. Either `GET` or `POST`.

  • sms_fallback_url (String) (defaults to: :unset)

    The URL that Twilio will request if an error occurs retrieving or executing the TwiML from ‘SmsUrl`.

  • sms_fallback_method (String) (defaults to: :unset)

    The HTTP method Twilio will use when requesting the above URL. Either ‘GET` or `POST`.

  • sms_status_callback (String) (defaults to: :unset)

    The URL that Twilio will ‘POST` to when a message is sent via the `/SMS/Messages` endpoint if you specify the `Sid` of this application on an outgoing SMS request.

  • message_status_callback (String) (defaults to: :unset)

    Twilio will make a ‘POST` request to this URL to pass status parameters (such as sent or failed) to your application if you use the `/Messages` endpoint to send the message and specify this application’s ‘Sid` as the `ApplicationSid` on an outgoing SMS request.

Returns:



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 296

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)
  data = Twilio::Values.of({
      'FriendlyName' => friendly_name,
      'ApiVersion' => api_version,
      'VoiceUrl' => voice_url,
      'VoiceMethod' => voice_method,
      'VoiceFallbackUrl' => voice_fallback_url,
      'VoiceFallbackMethod' => voice_fallback_method,
      'StatusCallback' => status_callback,
      'StatusCallbackMethod' => status_callback_method,
      'VoiceCallerIdLookup' => voice_caller_id_lookup,
      'SmsUrl' => sms_url,
      'SmsMethod' => sms_method,
      'SmsFallbackUrl' => sms_fallback_url,
      'SmsFallbackMethod' => sms_fallback_method,
      'SmsStatusCallback' => sms_status_callback,
      'MessageStatusCallback' => message_status_callback,
  })

  payload = @version.update(
      'POST',
      @uri,
      data: data,
  )

  ApplicationInstance.new(
      @version,
      payload,
      account_sid: @solution[:account_sid],
      sid: @solution[:sid],
  )
end