Class: Twilio::REST::Pricing::V2::NumberContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Pricing::V2::NumberContext
- Defined in:
- lib/twilio-ruby/rest/pricing/v2/number.rb
Instance Method Summary collapse
-
#fetch(origination_number: :unset) ⇒ NumberInstance
Fetch the NumberInstance.
-
#initialize(version, destination_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, destination_number) ⇒ NumberContext
Initialize the NumberContext
49 50 51 52 53 54 55 56 57 |
# File 'lib/twilio-ruby/rest/pricing/v2/number.rb', line 49 def initialize(version, destination_number) super(version) # Path Solution @solution = { destination_number: destination_number, } @uri = "/Trunking/Numbers/#{CGI.escape(@solution[:destination_number]).gsub("+", "%20")}" end |
Instance Method Details
#fetch(origination_number: :unset) ⇒ NumberInstance
Fetch the NumberInstance
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/twilio-ruby/rest/pricing/v2/number.rb', line 62 def fetch( origination_number: :unset ) params = Twilio::Values.of({ 'OriginationNumber' => origination_number, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, params: params, headers: headers) NumberInstance.new( @version, payload, destination_number: @solution[:destination_number], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
93 94 95 96 |
# File 'lib/twilio-ruby/rest/pricing/v2/number.rb', line 93 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Pricing.V2.NumberContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
86 87 88 89 |
# File 'lib/twilio-ruby/rest/pricing/v2/number.rb', line 86 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Pricing.V2.NumberContext #{context}>" end |