class Twilio::REST::Api::V2010::AccountContext::IncomingPhoneNumberContext

Public Class Methods

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

Initialize the IncomingPhoneNumberContext @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
IncomingPhoneNumber resource to fetch.

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

IncomingPhoneNumber resource to fetch.

@return [IncomingPhoneNumberContext] IncomingPhoneNumberContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
335 def initialize(version, account_sid, sid)
336   super(version)
337 
338   # Path Solution
339   @solution = {account_sid: account_sid, sid: sid, }
340   @uri = "/Accounts/#{@solution[:account_sid]}/IncomingPhoneNumbers/#{@solution[:sid]}.json"
341 
342   # Dependents
343   @assigned_add_ons = nil
344 end

Public Instance Methods

assigned_add_ons(sid=:unset) click to toggle source

Access the assigned_add_ons @return [AssignedAddOnList] @return [AssignedAddOnContext] if sid was passed.

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
473 def assigned_add_ons(sid=:unset)
474   raise ArgumentError, 'sid cannot be nil' if sid.nil?
475 
476   if sid != :unset
477     return AssignedAddOnContext.new(@version, @solution[:account_sid], @solution[:sid], sid, )
478   end
479 
480   unless @assigned_add_ons
481     @assigned_add_ons = AssignedAddOnList.new(
482         @version,
483         account_sid: @solution[:account_sid],
484         resource_sid: @solution[:sid],
485     )
486   end
487 
488   @assigned_add_ons
489 end
delete() click to toggle source

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

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
465 def delete
466    @version.delete('DELETE', @uri)
467 end
fetch() click to toggle source

Fetch the IncomingPhoneNumberInstance @return [IncomingPhoneNumberInstance] Fetched IncomingPhoneNumberInstance

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
451 def fetch
452   payload = @version.fetch('GET', @uri)
453 
454   IncomingPhoneNumberInstance.new(
455       @version,
456       payload,
457       account_sid: @solution[:account_sid],
458       sid: @solution[:sid],
459   )
460 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
500 def inspect
501   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
502   "#<Twilio.Api.V2010.IncomingPhoneNumberContext #{context}>"
503 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
493 def to_s
494   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
495   "#<Twilio.Api.V2010.IncomingPhoneNumberContext #{context}>"
496 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, bundle_sid: :unset) click to toggle source

Update the IncomingPhoneNumberInstance @param [String] account_sid The SID of the

{Account}[https://www.twilio.com/docs/iam/api/account] that created the
IncomingPhoneNumber resource to update.  For more information, see {Exchanging
Numbers Between
Subaccounts}[https://www.twilio.com/docs/iam/api/subaccounts#exchanging-numbers].

@param [String] api_version The API version to use for incoming calls made to

the phone number. The default is `2010-04-01`.

@param [String] friendly_name 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.

@param [String] sms_application_sid 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.

@param [String] sms_fallback_method The HTTP method that we should use to call

`sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`.

@param [String] sms_fallback_url The URL that we should call when an error

occurs while requesting or executing the TwiML defined by `sms_url`.

@param [String] sms_method The HTTP method that we should use to call `sms_url`.

Can be: `GET` or `POST` and defaults to `POST`.

@param [String] sms_url The URL we should call when the phone number receives an

incoming SMS message.

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

@param [String] voice_application_sid 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.

@param [Boolean] voice_caller_id_lookup 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`.

@param [String] voice_fallback_method The HTTP method that we should use to call

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

`voice_url`. Can be: `GET` or `POST` and defaults to `POST`.

@param [String] voice_url 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.

@param [incoming_phone_number.EmergencyStatus] emergency_status The

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

@param [String] emergency_address_sid The SID of the emergency address

configuration to use for emergency calling from this phone number.

@param [String] trunk_sid 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.

@param [incoming_phone_number.VoiceReceiveMode] voice_receive_mode The

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

@param [String] identity_sid The SID of the Identity resource that we should

associate with the phone number. Some regions require an identity to meet local
regulations.

@param [String] address_sid The SID of the Address resource we should associate

with the phone number. Some regions require addresses to meet local regulations.

@param [String] bundle_sid The SID of the Bundle resource that you associate

with the phone number. Some regions require a Bundle to meet local Regulations.

@return [IncomingPhoneNumberInstance] Updated IncomingPhoneNumberInstance

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
411 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, bundle_sid: :unset)
412   data = Twilio::Values.of({
413       'AccountSid' => account_sid,
414       'ApiVersion' => api_version,
415       'FriendlyName' => friendly_name,
416       'SmsApplicationSid' => sms_application_sid,
417       'SmsFallbackMethod' => sms_fallback_method,
418       'SmsFallbackUrl' => sms_fallback_url,
419       'SmsMethod' => sms_method,
420       'SmsUrl' => sms_url,
421       'StatusCallback' => status_callback,
422       'StatusCallbackMethod' => status_callback_method,
423       'VoiceApplicationSid' => voice_application_sid,
424       'VoiceCallerIdLookup' => voice_caller_id_lookup,
425       'VoiceFallbackMethod' => voice_fallback_method,
426       'VoiceFallbackUrl' => voice_fallback_url,
427       'VoiceMethod' => voice_method,
428       'VoiceUrl' => voice_url,
429       'EmergencyStatus' => emergency_status,
430       'EmergencyAddressSid' => emergency_address_sid,
431       'TrunkSid' => trunk_sid,
432       'VoiceReceiveMode' => voice_receive_mode,
433       'IdentitySid' => identity_sid,
434       'AddressSid' => address_sid,
435       'BundleSid' => bundle_sid,
436   })
437 
438   payload = @version.update('POST', @uri, data: data)
439 
440   IncomingPhoneNumberInstance.new(
441       @version,
442       payload,
443       account_sid: @solution[:account_sid],
444       sid: @solution[:sid],
445   )
446 end