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 SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Application resources to update.

  • sid (String)

    The Twilio-provided string that uniquely identifies the Application resource to update.



318
319
320
321
322
323
324
325
326
327
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 318

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

Delete the ApplicationInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

    @version.delete('DELETE', @uri, headers: headers)
end

#delete_with_metadataBoolean

Delete the ApplicationInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 344

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      application_instance = ApplicationInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      ApplicationInstanceMetadata.new(@version, application_instance, response.headers, response.status_code)
end

#fetchApplicationInstance

Fetch the ApplicationInstance

Returns:



363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 363

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    ApplicationInstance.new(
        @version,
        payload,
        account_sid: @solution[:account_sid],
        sid: @solution[:sid],
    )
end

#fetch_with_metadataApplicationInstance

Fetch the ApplicationInstanceMetadata

Returns:



383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 383

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    application_instance = ApplicationInstance.new(
        @version,
        response.body,
        account_sid: @solution[:account_sid],
        sid: @solution[:sid],
    )
    ApplicationInstanceMetadata.new(
        @version,
        application_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



566
567
568
569
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 566

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Api.V2010.ApplicationContext #{context}>"
end

#to_sObject

Provide a user friendly representation



559
560
561
562
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 559

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, public_application_connect_enabled: :unset) ⇒ ApplicationInstance

Update the ApplicationInstance

Parameters:

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

    A descriptive string that you create to describe the resource. It can be up to 64 characters long.

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

    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.

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

    The URL we should call when the phone number assigned to this application receives a call.

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

    The HTTP method we should use to call voice_url. Can be: GET or POST.

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

    The URL that we should call when an error occurs retrieving or executing the TwiML requested by url.

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

    The HTTP method we should use to call voice_fallback_url. Can be: GET or POST.

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

    The URL we should call using the status_callback_method to send status information to your application.

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

    The HTTP method we should use to call status_callback. Can be: GET or POST.

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

    Whether we should look up the caller’s caller-ID name from the CNAM database (additional charges apply). Can be: true or false.

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

    The URL we should call when the phone number receives an incoming SMS message.

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

    The HTTP method we should use to call sms_url. Can be: GET or POST.

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

    The URL that we should call when an error occurs while retrieving or executing the TwiML from sms_url.

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

    The HTTP method we should use to call sms_fallback_url. Can be: GET or POST.

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

    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.

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

    The URL we should call using a POST method to send message status information to your application.

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

    Whether to allow other Twilio accounts to dial this applicaton using Dial verb. Can be: true or false.

Returns:



425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 425

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, 
    public_application_connect_enabled: :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,
        'PublicApplicationConnectEnabled' => public_application_connect_enabled,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    ApplicationInstance.new(
        @version,
        payload,
        account_sid: @solution[:account_sid],
        sid: @solution[:sid],
    )
end

#update_with_metadata(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, public_application_connect_enabled: :unset) ⇒ ApplicationInstance

Update the ApplicationInstanceMetadata

Parameters:

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

    A descriptive string that you create to describe the resource. It can be up to 64 characters long.

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

    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.

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

    The URL we should call when the phone number assigned to this application receives a call.

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

    The HTTP method we should use to call voice_url. Can be: GET or POST.

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

    The URL that we should call when an error occurs retrieving or executing the TwiML requested by url.

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

    The HTTP method we should use to call voice_fallback_url. Can be: GET or POST.

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

    The URL we should call using the status_callback_method to send status information to your application.

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

    The HTTP method we should use to call status_callback. Can be: GET or POST.

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

    Whether we should look up the caller’s caller-ID name from the CNAM database (additional charges apply). Can be: true or false.

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

    The URL we should call when the phone number receives an incoming SMS message.

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

    The HTTP method we should use to call sms_url. Can be: GET or POST.

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

    The URL that we should call when an error occurs while retrieving or executing the TwiML from sms_url.

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

    The HTTP method we should use to call sms_fallback_url. Can be: GET or POST.

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

    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.

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

    The URL we should call using a POST method to send message status information to your application.

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

    Whether to allow other Twilio accounts to dial this applicaton using Dial verb. Can be: true or false.

Returns:



497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 497

def (
  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, 
  public_application_connect_enabled: :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,
        'PublicApplicationConnectEnabled' => public_application_connect_enabled,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    application_instance = ApplicationInstance.new(
        @version,
        response.body,
        account_sid: @solution[:account_sid],
        sid: @solution[:sid],
    )
    ApplicationInstanceMetadata.new(
        @version,
        application_instance,
        response.headers,
        response.status_code
    )
end