Class: Twilio::REST::Api::V2010::AccountContext::ApplicationInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, account_sid: nil, sid: nil) ⇒ ApplicationInstance

Initialize the ApplicationInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String) (defaults to: nil)

    The SID of the Account that created this Application resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 357

def initialize(version, payload , account_sid: nil, sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'api_version' => payload['api_version'],
        'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
        'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
        'friendly_name' => payload['friendly_name'],
        'message_status_callback' => payload['message_status_callback'],
        'sid' => payload['sid'],
        'sms_fallback_method' => payload['sms_fallback_method'],
        'sms_fallback_url' => payload['sms_fallback_url'],
        'sms_method' => payload['sms_method'],
        'sms_status_callback' => payload['sms_status_callback'],
        'sms_url' => payload['sms_url'],
        'status_callback' => payload['status_callback'],
        'status_callback_method' => payload['status_callback_method'],
        'uri' => payload['uri'],
        'voice_caller_id_lookup' => payload['voice_caller_id_lookup'],
        'voice_fallback_method' => payload['voice_fallback_method'],
        'voice_fallback_url' => payload['voice_fallback_url'],
        'voice_method' => payload['voice_method'],
        'voice_url' => payload['voice_url'],
        'public_application_connect_enabled' => payload['public_application_connect_enabled'],
    }

    # Context
    @instance_context = nil
    @params = { 'account_sid' =>   ,'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Application resource.

Returns:



403
404
405
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 403

def 
    @properties['account_sid']
end

#api_versionString

Returns The API version used to start a new TwiML session.

Returns:

  • (String)

    The API version used to start a new TwiML session.



409
410
411
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 409

def api_version
    @properties['api_version']
end

#contextApplicationContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



394
395
396
397
398
399
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 394

def context
    unless @instance_context
        @instance_context = ApplicationContext.new(@version , @params['account_sid'], @params['sid'])
    end
    @instance_context
end

#date_createdTime

Returns The date and time in GMT that the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



415
416
417
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 415

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT that the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



421
422
423
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 421

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the ApplicationInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



530
531
532
533
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 530

def delete

    context.delete
end

#fetchApplicationInstance

Fetch the ApplicationInstance

Returns:



538
539
540
541
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 538

def fetch

    context.fetch
end

#friendly_nameString

Returns The string that you assigned to describe the resource.

Returns:

  • (String)

    The string that you assigned to describe the resource.



427
428
429
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 427

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



610
611
612
613
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 610

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Api.V2010.ApplicationInstance #{values}>"
end

#message_status_callbackString

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

Returns:

  • (String)

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



433
434
435
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 433

def message_status_callback
    @properties['message_status_callback']
end

#public_application_connect_enabledBoolean

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

Returns:

  • (Boolean)

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



523
524
525
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 523

def public_application_connect_enabled
    @properties['public_application_connect_enabled']
end

#sidString

Returns The unique string that that we created to identify the Application resource.

Returns:

  • (String)

    The unique string that that we created to identify the Application resource.



439
440
441
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 439

def sid
    @properties['sid']
end

#sms_fallback_methodString

Returns The HTTP method we use to call ‘sms_fallback_url`. Can be: `GET` or `POST`.

Returns:

  • (String)

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



445
446
447
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 445

def sms_fallback_method
    @properties['sms_fallback_method']
end

#sms_fallback_urlString

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

Returns:

  • (String)

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



451
452
453
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 451

def sms_fallback_url
    @properties['sms_fallback_url']
end

#sms_methodString

Returns The HTTP method we use to call ‘sms_url`. Can be: `GET` or `POST`.

Returns:

  • (String)

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



457
458
459
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 457

def sms_method
    @properties['sms_method']
end

#sms_status_callbackString

Returns The URL we call using a POST method to send status information to your application about SMS messages that refer to the application.

Returns:

  • (String)

    The URL we call using a POST method to send status information to your application about SMS messages that refer to the application.



463
464
465
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 463

def sms_status_callback
    @properties['sms_status_callback']
end

#sms_urlString

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

Returns:

  • (String)

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



469
470
471
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 469

def sms_url
    @properties['sms_url']
end

#status_callbackString

Returns The URL we call using the ‘status_callback_method` to send status information to your application.

Returns:

  • (String)

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



475
476
477
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 475

def status_callback
    @properties['status_callback']
end

#status_callback_methodString

Returns The HTTP method we use to call ‘status_callback`. Can be: `GET` or `POST`.

Returns:

  • (String)

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



481
482
483
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 481

def status_callback_method
    @properties['status_callback_method']
end

#to_sObject

Provide a user friendly representation



603
604
605
606
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 603

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



562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 562

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
)

    context.update(
        friendly_name: friendly_name, 
        api_version: api_version, 
        voice_url: voice_url, 
        voice_method: voice_method, 
        voice_fallback_url: voice_fallback_url, 
        voice_fallback_method: voice_fallback_method, 
        status_callback: status_callback, 
        status_callback_method: status_callback_method, 
        voice_caller_id_lookup: voice_caller_id_lookup, 
        sms_url: sms_url, 
        sms_method: sms_method, 
        sms_fallback_url: sms_fallback_url, 
        sms_fallback_method: sms_fallback_method, 
        sms_status_callback: sms_status_callback, 
        message_status_callback: message_status_callback, 
        public_application_connect_enabled: public_application_connect_enabled, 
    )
end

#uriString

Returns The URI of the resource, relative to ‘api.twilio.com`.

Returns:

  • (String)

    The URI of the resource, relative to ‘api.twilio.com`.



487
488
489
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 487

def uri
    @properties['uri']
end

#voice_caller_id_lookupBoolean

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

Returns:

  • (Boolean)

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



493
494
495
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 493

def voice_caller_id_lookup
    @properties['voice_caller_id_lookup']
end

#voice_fallback_methodString

Returns The HTTP method we use to call ‘voice_fallback_url`. Can be: `GET` or `POST`.

Returns:

  • (String)

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



499
500
501
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 499

def voice_fallback_method
    @properties['voice_fallback_method']
end

#voice_fallback_urlString

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

Returns:

  • (String)

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



505
506
507
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 505

def voice_fallback_url
    @properties['voice_fallback_url']
end

#voice_methodString

Returns The HTTP method we use to call ‘voice_url`. Can be: `GET` or `POST`.

Returns:

  • (String)

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



511
512
513
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 511

def voice_method
    @properties['voice_method']
end

#voice_urlString

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

Returns:

  • (String)

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



517
518
519
# File 'lib/twilio-ruby/rest/api/v2010/account/application.rb', line 517

def voice_url
    @properties['voice_url']
end