class Twilio::REST::Pricing::V2::VoiceList::NumberInstance

Public Class Methods

new(version, payload, destination_number: nil) click to toggle source

Initialize the NumberInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] destination_number The destination phone number, in

{E.164}[https://www.twilio.com/docs/glossary/what-e164] format, for which to
fetch the origin-based voice pricing information. E.164 format consists of a +
followed by the country code and subscriber number.

@return [NumberInstance] NumberInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/pricing/v2/voice/number.rb
119 def initialize(version, payload, destination_number: nil)
120   super(version)
121 
122   # Marshaled Properties
123   @properties = {
124       'destination_number' => payload['destination_number'],
125       'origination_number' => payload['origination_number'],
126       'country' => payload['country'],
127       'iso_country' => payload['iso_country'],
128       'outbound_call_prices' => payload['outbound_call_prices'],
129       'inbound_call_price' => payload['inbound_call_price'],
130       'price_unit' => payload['price_unit'],
131       'url' => payload['url'],
132   }
133 
134   # Context
135   @instance_context = nil
136   @params = {'destination_number' => destination_number || @properties['destination_number'], }
137 end

Public Instance Methods

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 [NumberContext] NumberContext for this NumberInstance

    # File lib/twilio-ruby/rest/pricing/v2/voice/number.rb
143 def context
144   unless @instance_context
145     @instance_context = NumberContext.new(@version, @params['destination_number'], )
146   end
147   @instance_context
148 end
country() click to toggle source

@return [String] The name of the country

    # File lib/twilio-ruby/rest/pricing/v2/voice/number.rb
164 def country
165   @properties['country']
166 end
destination_number() click to toggle source

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

    # File lib/twilio-ruby/rest/pricing/v2/voice/number.rb
152 def destination_number
153   @properties['destination_number']
154 end
fetch(origination_number: :unset) click to toggle source

Fetch the NumberInstance @param [String] origination_number The origination phone number, in

{E.164}[https://www.twilio.com/docs/glossary/what-e164] format, for which to
fetch the origin-based voice pricing information. E.164 format consists of a +
followed by the country code and subscriber number.

@return [NumberInstance] Fetched NumberInstance

    # File lib/twilio-ruby/rest/pricing/v2/voice/number.rb
205 def fetch(origination_number: :unset)
206   context.fetch(origination_number: origination_number, )
207 end
inbound_call_price() click to toggle source

@return [String] The InboundCallPrice record

    # File lib/twilio-ruby/rest/pricing/v2/voice/number.rb
182 def inbound_call_price
183   @properties['inbound_call_price']
184 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/pricing/v2/voice/number.rb
218 def inspect
219   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
220   "<Twilio.Pricing.V2.NumberInstance #{values}>"
221 end
iso_country() click to toggle source

@return [String] The ISO country code

    # File lib/twilio-ruby/rest/pricing/v2/voice/number.rb
170 def iso_country
171   @properties['iso_country']
172 end
origination_number() click to toggle source

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

    # File lib/twilio-ruby/rest/pricing/v2/voice/number.rb
158 def origination_number
159   @properties['origination_number']
160 end
outbound_call_prices() click to toggle source

@return [Array] The list of OutboundCallPriceWithOrigin records

    # File lib/twilio-ruby/rest/pricing/v2/voice/number.rb
176 def outbound_call_prices
177   @properties['outbound_call_prices']
178 end
price_unit() click to toggle source

@return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy)

    # File lib/twilio-ruby/rest/pricing/v2/voice/number.rb
188 def price_unit
189   @properties['price_unit']
190 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/pricing/v2/voice/number.rb
211 def to_s
212   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
213   "<Twilio.Pricing.V2.NumberInstance #{values}>"
214 end
url() click to toggle source

@return [String] The absolute URL of the resource

    # File lib/twilio-ruby/rest/pricing/v2/voice/number.rb
194 def url
195   @properties['url']
196 end