Class: Twilio::REST::Pricing::V1::VoiceList::NumberContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Pricing::V1::VoiceList::NumberContext
- Defined in:
- lib/twilio-ruby/rest/pricing/v1/voice/number.rb
Instance Method Summary collapse
-
#fetch ⇒ NumberInstance
Fetch the NumberInstance.
-
#fetch_with_metadata ⇒ NumberInstance
Fetch the NumberInstanceMetadata.
-
#initialize(version, number) ⇒ NumberContext
constructor
Initialize the NumberContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, number) ⇒ NumberContext
Initialize the NumberContext
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 52 def initialize(version, number) super(version) # Path Solution @solution = { number: number, } @uri = "/Voice/Numbers/#{CGI.escape(@solution[:number]).gsub("+", "%20")}" end |
Instance Method Details
#fetch ⇒ NumberInstance
Fetch the NumberInstance
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 65 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) NumberInstance.new( @version, payload, number: @solution[:number], ) end |
#fetch_with_metadata ⇒ NumberInstance
Fetch the NumberInstanceMetadata
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 84 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) number_instance = NumberInstance.new( @version, response.body, number: @solution[:number], ) NumberInstanceMetadata.new( @version, number_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
116 117 118 119 |
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 116 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Pricing.V1.NumberContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
109 110 111 112 |
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 109 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Pricing.V1.NumberContext #{context}>" end |