class Twilio::REST::Api::V2010::AccountContext::IncomingPhoneNumberInstance

Public Class Methods

new(version, payload, account_sid: nil, sid: nil) click to toggle source

Initialize the IncomingPhoneNumberInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] account_sid The SID of the

{Account}[https://www.twilio.com/docs/iam/api/account] that created this
IncomingPhoneNumber resource.

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

IncomingPhoneNumber resource to fetch.

@return [IncomingPhoneNumberInstance] IncomingPhoneNumberInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
517 def initialize(version, payload, account_sid: nil, sid: nil)
518   super(version)
519 
520   # Marshaled Properties
521   @properties = {
522       'account_sid' => payload['account_sid'],
523       'address_sid' => payload['address_sid'],
524       'address_requirements' => payload['address_requirements'],
525       'api_version' => payload['api_version'],
526       'beta' => payload['beta'],
527       'capabilities' => payload['capabilities'],
528       'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
529       'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
530       'friendly_name' => payload['friendly_name'],
531       'identity_sid' => payload['identity_sid'],
532       'phone_number' => payload['phone_number'],
533       'origin' => payload['origin'],
534       'sid' => payload['sid'],
535       'sms_application_sid' => payload['sms_application_sid'],
536       'sms_fallback_method' => payload['sms_fallback_method'],
537       'sms_fallback_url' => payload['sms_fallback_url'],
538       'sms_method' => payload['sms_method'],
539       'sms_url' => payload['sms_url'],
540       'status_callback' => payload['status_callback'],
541       'status_callback_method' => payload['status_callback_method'],
542       'trunk_sid' => payload['trunk_sid'],
543       'uri' => payload['uri'],
544       'voice_receive_mode' => payload['voice_receive_mode'],
545       'voice_application_sid' => payload['voice_application_sid'],
546       'voice_caller_id_lookup' => payload['voice_caller_id_lookup'],
547       'voice_fallback_method' => payload['voice_fallback_method'],
548       'voice_fallback_url' => payload['voice_fallback_url'],
549       'voice_method' => payload['voice_method'],
550       'voice_url' => payload['voice_url'],
551       'emergency_status' => payload['emergency_status'],
552       'emergency_address_sid' => payload['emergency_address_sid'],
553       'bundle_sid' => payload['bundle_sid'],
554       'status' => payload['status'],
555   }
556 
557   # Context
558   @instance_context = nil
559   @params = {'account_sid' => account_sid, 'sid' => sid || @properties['sid'], }
560 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The SID of the Account that created the resource

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
575 def account_sid
576   @properties['account_sid']
577 end
address_requirements() click to toggle source

@return [incoming_phone_number.AddressRequirement] Whether the phone number requires an Address registered with Twilio.

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
587 def address_requirements
588   @properties['address_requirements']
589 end
address_sid() click to toggle source

@return [String] The SID of the Address resource associated with the phone number

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
581 def address_sid
582   @properties['address_sid']
583 end
api_version() click to toggle source

@return [String] The API version used to start a new TwiML session

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
593 def api_version
594   @properties['api_version']
595 end
assigned_add_ons() click to toggle source

Access the assigned_add_ons @return [assigned_add_ons] assigned_add_ons

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
881 def assigned_add_ons
882   context.assigned_add_ons
883 end
beta() click to toggle source

@return [Boolean] Whether the phone number is new to the Twilio platform

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
599 def beta
600   @properties['beta']
601 end
bundle_sid() click to toggle source

@return [String] The SID of the Bundle resource associated with number

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
761 def bundle_sid
762   @properties['bundle_sid']
763 end
capabilities() click to toggle source

@return [String] Indicate if a phone can receive calls or messages

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
605 def capabilities
606   @properties['capabilities']
607 end
context() click to toggle source

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [IncomingPhoneNumberContext] IncomingPhoneNumberContext for this IncomingPhoneNumberInstance

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
566 def context
567   unless @instance_context
568     @instance_context = IncomingPhoneNumberContext.new(@version, @params['account_sid'], @params['sid'], )
569   end
570   @instance_context
571 end
date_created() click to toggle source

@return [Time] The RFC 2822 date and time in GMT that the resource was created

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
611 def date_created
612   @properties['date_created']
613 end
date_updated() click to toggle source

@return [Time] The RFC 2822 date and time in GMT that the resource was last updated

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
617 def date_updated
618   @properties['date_updated']
619 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
874 def delete
875   context.delete
876 end
emergency_address_sid() click to toggle source

@return [String] The emergency address configuration to use for emergency calling

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
755 def emergency_address_sid
756   @properties['emergency_address_sid']
757 end
emergency_status() click to toggle source

@return [incoming_phone_number.EmergencyStatus] Whether the phone number is enabled for emergency calling

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
749 def emergency_status
750   @properties['emergency_status']
751 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
867 def fetch
868   context.fetch
869 end
friendly_name() click to toggle source

@return [String] The string that you assigned to describe the resource

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
623 def friendly_name
624   @properties['friendly_name']
625 end
identity_sid() click to toggle source

@return [String] The SID of the Identity resource associated with number

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
629 def identity_sid
630   @properties['identity_sid']
631 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
894 def inspect
895   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
896   "<Twilio.Api.V2010.IncomingPhoneNumberInstance #{values}>"
897 end
origin() click to toggle source

@return [String] The phone number's origin. Can be twilio or hosted.

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
641 def origin
642   @properties['origin']
643 end
phone_number() click to toggle source

@return [String] The phone number in E.164 format

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
635 def phone_number
636   @properties['phone_number']
637 end
sid() click to toggle source

@return [String] The unique string that identifies the resource

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
647 def sid
648   @properties['sid']
649 end
sms_application_sid() click to toggle source

@return [String] The SID of the application that handles SMS messages sent to the phone number

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
653 def sms_application_sid
654   @properties['sms_application_sid']
655 end
sms_fallback_method() click to toggle source

@return [String] The HTTP method used with sms_fallback_url

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
659 def sms_fallback_method
660   @properties['sms_fallback_method']
661 end
sms_fallback_url() click to toggle source

@return [String] The URL that we call when an error occurs while retrieving or executing the TwiML

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
665 def sms_fallback_url
666   @properties['sms_fallback_url']
667 end
sms_method() click to toggle source

@return [String] The HTTP method to use with sms_url

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
671 def sms_method
672   @properties['sms_method']
673 end
sms_url() click to toggle source

@return [String] The URL we call when the phone number receives an incoming SMS message

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
677 def sms_url
678   @properties['sms_url']
679 end
status() click to toggle source

@return [String] The status

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
767 def status
768   @properties['status']
769 end
status_callback() click to toggle source

@return [String] The URL to send status information to your application

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
683 def status_callback
684   @properties['status_callback']
685 end
status_callback_method() click to toggle source

@return [String] The HTTP method we use to call status_callback

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
689 def status_callback_method
690   @properties['status_callback_method']
691 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
887 def to_s
888   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
889   "<Twilio.Api.V2010.IncomingPhoneNumberInstance #{values}>"
890 end
trunk_sid() click to toggle source

@return [String] The SID of the Trunk that handles calls to the phone number

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
695 def trunk_sid
696   @properties['trunk_sid']
697 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
836 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)
837   context.update(
838       account_sid: account_sid,
839       api_version: api_version,
840       friendly_name: friendly_name,
841       sms_application_sid: sms_application_sid,
842       sms_fallback_method: sms_fallback_method,
843       sms_fallback_url: sms_fallback_url,
844       sms_method: sms_method,
845       sms_url: sms_url,
846       status_callback: status_callback,
847       status_callback_method: status_callback_method,
848       voice_application_sid: voice_application_sid,
849       voice_caller_id_lookup: voice_caller_id_lookup,
850       voice_fallback_method: voice_fallback_method,
851       voice_fallback_url: voice_fallback_url,
852       voice_method: voice_method,
853       voice_url: voice_url,
854       emergency_status: emergency_status,
855       emergency_address_sid: emergency_address_sid,
856       trunk_sid: trunk_sid,
857       voice_receive_mode: voice_receive_mode,
858       identity_sid: identity_sid,
859       address_sid: address_sid,
860       bundle_sid: bundle_sid,
861   )
862 end
uri() click to toggle source

@return [String] The URI of the resource, relative to `api.twilio.com`

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
701 def uri
702   @properties['uri']
703 end
voice_application_sid() click to toggle source

@return [String] The SID of the application that handles calls to the phone number

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
713 def voice_application_sid
714   @properties['voice_application_sid']
715 end
voice_caller_id_lookup() click to toggle source

@return [Boolean] Whether to lookup the caller's name

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
719 def voice_caller_id_lookup
720   @properties['voice_caller_id_lookup']
721 end
voice_fallback_method() click to toggle source

@return [String] The HTTP method used with voice_fallback_url

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
725 def voice_fallback_method
726   @properties['voice_fallback_method']
727 end
voice_fallback_url() click to toggle source

@return [String] The URL we call when an error occurs in TwiML

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
731 def voice_fallback_url
732   @properties['voice_fallback_url']
733 end
voice_method() click to toggle source

@return [String] The HTTP method used with the voice_url

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
737 def voice_method
738   @properties['voice_method']
739 end
voice_receive_mode() click to toggle source

@return [incoming_phone_number.VoiceReceiveMode] The voice_receive_mode

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
707 def voice_receive_mode
708   @properties['voice_receive_mode']
709 end
voice_url() click to toggle source

@return [String] The URL we call when the phone number receives a call

    # File lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb
743 def voice_url
744   @properties['voice_url']
745 end