class Twilio::REST::Trunking::V1::TrunkContext::PhoneNumberInstance

Public Class Methods

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

Initialize the PhoneNumberInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] trunk_sid The SID of the Trunk that handles calls to the phone

number. If a `trunk_sid` is present, we ignore all of the voice URLs and voice
applications and use those set on the Trunk. Setting a `trunk_sid` will
automatically delete your `voice_application_sid` and vice versa.

@param [String] sid The unique string that we created to identify the

PhoneNumber resource to fetch.

@return [PhoneNumberInstance] PhoneNumberInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
221 def initialize(version, payload, trunk_sid: nil, sid: nil)
222   super(version)
223 
224   # Marshaled Properties
225   @properties = {
226       'account_sid' => payload['account_sid'],
227       'address_requirements' => payload['address_requirements'],
228       'api_version' => payload['api_version'],
229       'beta' => payload['beta'],
230       'capabilities' => payload['capabilities'],
231       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
232       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
233       'friendly_name' => payload['friendly_name'],
234       'links' => payload['links'],
235       'phone_number' => payload['phone_number'],
236       'sid' => payload['sid'],
237       'sms_application_sid' => payload['sms_application_sid'],
238       'sms_fallback_method' => payload['sms_fallback_method'],
239       'sms_fallback_url' => payload['sms_fallback_url'],
240       'sms_method' => payload['sms_method'],
241       'sms_url' => payload['sms_url'],
242       'status_callback' => payload['status_callback'],
243       'status_callback_method' => payload['status_callback_method'],
244       'trunk_sid' => payload['trunk_sid'],
245       'url' => payload['url'],
246       'voice_application_sid' => payload['voice_application_sid'],
247       'voice_caller_id_lookup' => payload['voice_caller_id_lookup'],
248       'voice_fallback_method' => payload['voice_fallback_method'],
249       'voice_fallback_url' => payload['voice_fallback_url'],
250       'voice_method' => payload['voice_method'],
251       'voice_url' => payload['voice_url'],
252   }
253 
254   # Context
255   @instance_context = nil
256   @params = {'trunk_sid' => trunk_sid, 'sid' => sid || @properties['sid'], }
257 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/trunking/v1/trunk/phone_number.rb
272 def account_sid
273   @properties['account_sid']
274 end
address_requirements() click to toggle source

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

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
278 def address_requirements
279   @properties['address_requirements']
280 end
api_version() click to toggle source

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

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
284 def api_version
285   @properties['api_version']
286 end
beta() click to toggle source

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

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
290 def beta
291   @properties['beta']
292 end
capabilities() click to toggle source

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

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
296 def capabilities
297   @properties['capabilities']
298 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 [PhoneNumberContext] PhoneNumberContext for this PhoneNumberInstance

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
263 def context
264   unless @instance_context
265     @instance_context = PhoneNumberContext.new(@version, @params['trunk_sid'], @params['sid'], )
266   end
267   @instance_context
268 end
date_created() click to toggle source

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

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
302 def date_created
303   @properties['date_created']
304 end
date_updated() click to toggle source

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

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
308 def date_updated
309   @properties['date_updated']
310 end
delete() click to toggle source

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

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
436 def delete
437   context.delete
438 end
fetch() click to toggle source

Fetch the PhoneNumberInstance @return [PhoneNumberInstance] Fetched PhoneNumberInstance

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
429 def fetch
430   context.fetch
431 end
friendly_name() click to toggle source

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

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
314 def friendly_name
315   @properties['friendly_name']
316 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
449 def inspect
450   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
451   "<Twilio.Trunking.V1.PhoneNumberInstance #{values}>"
452 end
phone_number() click to toggle source

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

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
326 def phone_number
327   @properties['phone_number']
328 end
sid() click to toggle source

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

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
332 def sid
333   @properties['sid']
334 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/trunking/v1/trunk/phone_number.rb
338 def sms_application_sid
339   @properties['sms_application_sid']
340 end
sms_fallback_method() click to toggle source

@return [String] The HTTP method used with sms_fallback_url

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
344 def sms_fallback_method
345   @properties['sms_fallback_method']
346 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/trunking/v1/trunk/phone_number.rb
350 def sms_fallback_url
351   @properties['sms_fallback_url']
352 end
sms_method() click to toggle source

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

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
356 def sms_method
357   @properties['sms_method']
358 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/trunking/v1/trunk/phone_number.rb
362 def sms_url
363   @properties['sms_url']
364 end
status_callback() click to toggle source

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

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
368 def status_callback
369   @properties['status_callback']
370 end
status_callback_method() click to toggle source

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

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
374 def status_callback_method
375   @properties['status_callback_method']
376 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
442 def to_s
443   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
444   "<Twilio.Trunking.V1.PhoneNumberInstance #{values}>"
445 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/trunking/v1/trunk/phone_number.rb
380 def trunk_sid
381   @properties['trunk_sid']
382 end
url() click to toggle source

@return [String] The absolute URL of the resource

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
386 def url
387   @properties['url']
388 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/trunking/v1/trunk/phone_number.rb
392 def voice_application_sid
393   @properties['voice_application_sid']
394 end
voice_caller_id_lookup() click to toggle source

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

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
398 def voice_caller_id_lookup
399   @properties['voice_caller_id_lookup']
400 end
voice_fallback_method() click to toggle source

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

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
404 def voice_fallback_method
405   @properties['voice_fallback_method']
406 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/trunking/v1/trunk/phone_number.rb
410 def voice_fallback_url
411   @properties['voice_fallback_url']
412 end
voice_method() click to toggle source

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

    # File lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb
416 def voice_method
417   @properties['voice_method']
418 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/trunking/v1/trunk/phone_number.rb
422 def voice_url
423   @properties['voice_url']
424 end