Class: Twilio::REST::Api::V2010::AccountContext::IncomingPhoneNumberContext

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

Defined Under Namespace

Classes: AssignedAddOnContext, AssignedAddOnInstance, AssignedAddOnList, AssignedAddOnPage

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, sid) ⇒ IncomingPhoneNumberContext

Initialize the IncomingPhoneNumberContext

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String)

    The SID of the [Account](www.twilio.com/docs/api/rest/account) that created the IncomingPhoneNumber resource to fetch.

  • sid (String)

    The Twilio-provided string that uniquely identifies the IncomingPhoneNumber resource to fetch.



339
340
341
342
343
344
345
346
347
348
# File 'lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb', line 339

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

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

  # Dependents
  @assigned_add_ons = nil
end

Instance Method Details

#assigned_add_ons(sid = :unset) ⇒ AssignedAddOnList, AssignedAddOnContext

Access the assigned_add_ons

Returns:

Raises:

  • (ArgumentError)


484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
# File 'lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb', line 484

def assigned_add_ons(sid=:unset)
  raise ArgumentError, 'sid cannot be nil' if sid.nil?

  if sid != :unset
    return AssignedAddOnContext.new(@version, @solution[:account_sid], @solution[:sid], sid, )
  end

  unless @assigned_add_ons
    @assigned_add_ons = AssignedAddOnList.new(
        @version,
        account_sid: @solution[:account_sid],
        resource_sid: @solution[:sid],
    )
  end

  @assigned_add_ons
end

#deleteBoolean

Deletes the IncomingPhoneNumberInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

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

#fetchIncomingPhoneNumberInstance

Fetch a IncomingPhoneNumberInstance

Returns:



456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb', line 456

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

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

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

#inspectObject

Provide a detailed, user friendly representation



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

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

#to_sObject

Provide a user friendly representation



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

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

#update(account_sid: :unset, api_version: :unset, friendly_name: :unset, sms_application_sid: :unset, sms_fallback_method: :unset, sms_fallback_url: :unset, sms_method: :unset, sms_url: :unset, status_callback: :unset, status_callback_method: :unset, voice_application_sid: :unset, voice_caller_id_lookup: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_url: :unset, emergency_status: :unset, emergency_address_sid: :unset, trunk_sid: :unset, voice_receive_mode: :unset, identity_sid: :unset, address_sid: :unset) ⇒ IncomingPhoneNumberInstance

Update the IncomingPhoneNumberInstance

Parameters:

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

    The SID of the [Account](www.twilio.com/docs/api/rest/account) that created the IncomingPhoneNumber resource to update. For more information, see [Exchanging Numbers Between Subaccounts](www.twilio.com/docs/iam/api/subaccounts#exchanging-numbers).

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

    The API version to use for incoming calls made to the phone number. The default is ‘2010-04-01`.

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

    A descriptive string that you created to describe this phone number. It can be up to 64 characters long. By default, this is a formatted version of the phone number.

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

    The SID of the application that should handle SMS messages sent to the number. If an ‘sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those set on the application.

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

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

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

    The URL that we should call when an error occurs while requesting or executing the TwiML defined by ‘sms_url`.

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

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

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

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

  • 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` and defaults to `POST`.

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

    The SID of the application we should use to handle phone calls to the phone number. If a ‘voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa.

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

    Whether to lookup the caller’s name from the CNAM database and post it to your app. Can be: ‘true` or `false` and defaults to `false`.

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

    The HTTP method that we should use to call ‘voice_fallback_url`. Can be: `GET` or `POST` and defaults to `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_method (String) (defaults to: :unset)

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

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

    The URL that we should call to answer a call to the phone number. The ‘voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set.

  • emergency_status (incoming_phone_number.EmergencyStatus) (defaults to: :unset)

    The configuration status parameter that determines whether the phone number is enabled for emergency calling.

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

    The SID of the emergency address configuration to use for emergency calling from this phone number.

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

    The SID of the Trunk we should use to handle phone calls to the phone number. If a ‘trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa.

  • voice_receive_mode (incoming_phone_number.VoiceReceiveMode) (defaults to: :unset)

    The configuration parameter for the phone number to receive incoming voice calls or faxes. Can be: ‘fax` or `voice` and defaults to `voice`.

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

    The SID of the Identity resource that we should associate with the phone number. Some regions require an identity to meet local regulations.

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

    The SID of the Address resource we should associate with the phone number. Some regions require addresses to meet local regulations.

Returns:



413
414
415
416
417
418
419
420
421
422
423
424
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
# File 'lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb', line 413

def update(account_sid: :unset, api_version: :unset, friendly_name: :unset, sms_application_sid: :unset, sms_fallback_method: :unset, sms_fallback_url: :unset, sms_method: :unset, sms_url: :unset, status_callback: :unset, status_callback_method: :unset, voice_application_sid: :unset, voice_caller_id_lookup: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_url: :unset, emergency_status: :unset, emergency_address_sid: :unset, trunk_sid: :unset, voice_receive_mode: :unset, identity_sid: :unset, address_sid: :unset)
  data = Twilio::Values.of({
      'AccountSid' => ,
      'ApiVersion' => api_version,
      'FriendlyName' => friendly_name,
      'SmsApplicationSid' => sms_application_sid,
      'SmsFallbackMethod' => sms_fallback_method,
      'SmsFallbackUrl' => sms_fallback_url,
      'SmsMethod' => sms_method,
      'SmsUrl' => sms_url,
      'StatusCallback' => status_callback,
      'StatusCallbackMethod' => status_callback_method,
      'VoiceApplicationSid' => voice_application_sid,
      'VoiceCallerIdLookup' => voice_caller_id_lookup,
      'VoiceFallbackMethod' => voice_fallback_method,
      'VoiceFallbackUrl' => voice_fallback_url,
      'VoiceMethod' => voice_method,
      'VoiceUrl' => voice_url,
      'EmergencyStatus' => emergency_status,
      'EmergencyAddressSid' => emergency_address_sid,
      'TrunkSid' => trunk_sid,
      'VoiceReceiveMode' => voice_receive_mode,
      'IdentitySid' => identity_sid,
      'AddressSid' => address_sid,
  })

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

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