class Twilio::REST::Pricing::V2::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/number.rb
118 def initialize(version, payload, destination_number: nil)
119   super(version)
120 
121   # Marshaled Properties
122   @properties = {
123       'destination_number' => payload['destination_number'],
124       'origination_number' => payload['origination_number'],
125       'country' => payload['country'],
126       'iso_country' => payload['iso_country'],
127       'terminating_prefix_prices' => payload['terminating_prefix_prices'],
128       'originating_call_price' => payload['originating_call_price'],
129       'price_unit' => payload['price_unit'],
130       'url' => payload['url'],
131   }
132 
133   # Context
134   @instance_context = nil
135   @params = {'destination_number' => destination_number || @properties['destination_number'], }
136 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/number.rb
142 def context
143   unless @instance_context
144     @instance_context = NumberContext.new(@version, @params['destination_number'], )
145   end
146   @instance_context
147 end
country() click to toggle source

@return [String] The name of the country

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

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

    # File lib/twilio-ruby/rest/pricing/v2/number.rb
151 def destination_number
152   @properties['destination_number']
153 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/number.rb
204 def fetch(origination_number: :unset)
205   context.fetch(origination_number: origination_number, )
206 end
inspect() click to toggle source

Provide a detailed, user friendly representation

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

@return [String] The ISO country code

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

@return [String] The OriginatingCallPrice record

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

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

    # File lib/twilio-ruby/rest/pricing/v2/number.rb
157 def origination_number
158   @properties['origination_number']
159 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/number.rb
187 def price_unit
188   @properties['price_unit']
189 end
terminating_prefix_prices() click to toggle source

@return [Array] The terminating_prefix_prices

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

Provide a user friendly representation

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

@return [String] The absolute URL of the resource

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