class Twilio::REST::Proxy::V1::ServiceContext::PhoneNumberInstance
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Public Class Methods
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 PhoneNumber resource's parent
{Service}[https://www.twilio.com/docs/proxy/api/service] resource.
@param [String] sid The Twilio-provided string that uniquely identifies the
PhoneNumber resource to fetch.
@return [PhoneNumberInstance] PhoneNumberInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb 260 def initialize(version, payload, service_sid: nil, sid: nil) 261 super(version) 262 263 # Marshaled Properties 264 @properties = { 265 'sid' => payload['sid'], 266 'account_sid' => payload['account_sid'], 267 'service_sid' => payload['service_sid'], 268 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 269 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 270 'phone_number' => payload['phone_number'], 271 'friendly_name' => payload['friendly_name'], 272 'iso_country' => payload['iso_country'], 273 'capabilities' => payload['capabilities'], 274 'url' => payload['url'], 275 'is_reserved' => payload['is_reserved'], 276 'in_use' => payload['in_use'].to_i, 277 } 278 279 # Context 280 @instance_context = nil 281 @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], } 282 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb 303 def account_sid 304 @properties['account_sid'] 305 end
@return [String] The capabilities of the phone number
# File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb 345 def capabilities 346 @properties['capabilities'] 347 end
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/proxy/v1/service/phone_number.rb 288 def context 289 unless @instance_context 290 @instance_context = PhoneNumberContext.new(@version, @params['service_sid'], @params['sid'], ) 291 end 292 @instance_context 293 end
@return [Time] The ISO 8601 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb 315 def date_created 316 @properties['date_created'] 317 end
@return [Time] The ISO 8601 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb 321 def date_updated 322 @properties['date_updated'] 323 end
Delete the PhoneNumberInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb 370 def delete 371 context.delete 372 end
Fetch the PhoneNumberInstance
@return [PhoneNumberInstance] Fetched PhoneNumberInstance
# File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb 377 def fetch 378 context.fetch 379 end
@return [String] The string that you assigned to describe the resource
# File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb 333 def friendly_name 334 @properties['friendly_name'] 335 end
@return [String] The number of open session assigned to the number.
# File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb 363 def in_use 364 @properties['in_use'] 365 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb 401 def inspect 402 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 403 "<Twilio.Proxy.V1.PhoneNumberInstance #{values}>" 404 end
@return [Boolean] Reserve the phone number for manual assignment to participants only
# File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb 357 def is_reserved 358 @properties['is_reserved'] 359 end
@return [String] The ISO Country Code
# File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb 339 def iso_country 340 @properties['iso_country'] 341 end
@return [String] The phone number in E.164 format
# File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb 327 def phone_number 328 @properties['phone_number'] 329 end
@return [String] The SID of the PhoneNumber resource's parent Service resource
# File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb 309 def service_sid 310 @properties['service_sid'] 311 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb 297 def sid 298 @properties['sid'] 299 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb 394 def to_s 395 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 396 "<Twilio.Proxy.V1.PhoneNumberInstance #{values}>" 397 end
Update the PhoneNumberInstance
@param [Boolean] is_reserved
Whether the phone number should be reserved and not
be assigned to a participant using proxy pool logic. See {Reserved Phone Numbers}[https://www.twilio.com/docs/proxy/reserved-phone-numbers] for more information.
@return [PhoneNumberInstance] Updated PhoneNumberInstance
# File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb 388 def update(is_reserved: :unset) 389 context.update(is_reserved: is_reserved, ) 390 end
@return [String] The absolute URL of the PhoneNumber resource
# File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb 351 def url 352 @properties['url'] 353 end