Class: Twilio::REST::Routes::V2::PhoneNumberContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Routes::V2::PhoneNumberContext
- Defined in:
- lib/twilio-ruby/rest/routes/v2/phone_number.rb
Instance Method Summary collapse
-
#fetch ⇒ PhoneNumberInstance
Fetch the PhoneNumberInstance.
-
#initialize(version, phone_number) ⇒ PhoneNumberContext
constructor
Initialize the PhoneNumberContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(voice_region: :unset, friendly_name: :unset) ⇒ PhoneNumberInstance
Update the PhoneNumberInstance.
Constructor Details
#initialize(version, phone_number) ⇒ PhoneNumberContext
Initialize the PhoneNumberContext
49 50 51 52 53 54 55 56 57 |
# File 'lib/twilio-ruby/rest/routes/v2/phone_number.rb', line 49 def initialize(version, phone_number) super(version) # Path Solution @solution = { phone_number: phone_number, } @uri = "/PhoneNumbers/#{@solution[:phone_number]}" end |
Instance Method Details
#fetch ⇒ PhoneNumberInstance
Fetch the PhoneNumberInstance
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/twilio-ruby/rest/routes/v2/phone_number.rb', line 61 def fetch payload = @version.fetch('GET', @uri) PhoneNumberInstance.new( @version, payload, phone_number: @solution[:phone_number], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
106 107 108 109 |
# File 'lib/twilio-ruby/rest/routes/v2/phone_number.rb', line 106 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Routes.V2.PhoneNumberContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
99 100 101 102 |
# File 'lib/twilio-ruby/rest/routes/v2/phone_number.rb', line 99 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Routes.V2.PhoneNumberContext #{context}>" end |
#update(voice_region: :unset, friendly_name: :unset) ⇒ PhoneNumberInstance
Update the PhoneNumberInstance
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/twilio-ruby/rest/routes/v2/phone_number.rb', line 77 def update( voice_region: :unset, friendly_name: :unset ) data = Twilio::Values.of({ 'VoiceRegion' => voice_region, 'FriendlyName' => friendly_name, }) payload = @version.update('POST', @uri, data: data) PhoneNumberInstance.new( @version, payload, phone_number: @solution[:phone_number], ) end |