class Twilio::REST::Messaging::V1::ServiceContext::PhoneNumberInstance

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Public Class Methods

new(version, payload, service_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] service_sid The SID of the

{Service}[https://www.twilio.com/docs/chat/rest/service-resource] the resource
is associated with.

@param [String] sid The SID of the PhoneNumber resource to fetch. @return [PhoneNumberInstance] PhoneNumberInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb
230 def initialize(version, payload, service_sid: nil, sid: nil)
231   super(version)
232 
233   # Marshaled Properties
234   @properties = {
235       'sid' => payload['sid'],
236       'account_sid' => payload['account_sid'],
237       'service_sid' => payload['service_sid'],
238       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
239       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
240       'phone_number' => payload['phone_number'],
241       'country_code' => payload['country_code'],
242       'capabilities' => payload['capabilities'],
243       'url' => payload['url'],
244   }
245 
246   # Context
247   @instance_context = nil
248   @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], }
249 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/messaging/v1/service/phone_number.rb
270 def account_sid
271   @properties['account_sid']
272 end
capabilities() click to toggle source

@return [Array] An array of values that describe whether the number can receive calls or messages

    # File lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb
306 def capabilities
307   @properties['capabilities']
308 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/messaging/v1/service/phone_number.rb
255 def context
256   unless @instance_context
257     @instance_context = PhoneNumberContext.new(@version, @params['service_sid'], @params['sid'], )
258   end
259   @instance_context
260 end
country_code() click to toggle source

@return [String] The 2-character ISO Country Code of the number

    # File lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb
300 def country_code
301   @properties['country_code']
302 end
date_created() click to toggle source

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

    # File lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb
282 def date_created
283   @properties['date_created']
284 end
date_updated() click to toggle source

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

    # File lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb
288 def date_updated
289   @properties['date_updated']
290 end
delete() click to toggle source

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

    # File lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb
319 def delete
320   context.delete
321 end
fetch() click to toggle source

Fetch the PhoneNumberInstance @return [PhoneNumberInstance] Fetched PhoneNumberInstance

    # File lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb
326 def fetch
327   context.fetch
328 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb
339 def inspect
340   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
341   "<Twilio.Messaging.V1.PhoneNumberInstance #{values}>"
342 end
phone_number() click to toggle source

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

    # File lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb
294 def phone_number
295   @properties['phone_number']
296 end
service_sid() click to toggle source

@return [String] The SID of the Service that the resource is associated with

    # File lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb
276 def service_sid
277   @properties['service_sid']
278 end
sid() click to toggle source

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

    # File lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb
264 def sid
265   @properties['sid']
266 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb
332 def to_s
333   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
334   "<Twilio.Messaging.V1.PhoneNumberInstance #{values}>"
335 end
url() click to toggle source

@return [String] The absolute URL of the PhoneNumber resource

    # File lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb
312 def url
313   @properties['url']
314 end