Class: Twilio::REST::Pricing::V2::NumberInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Pricing::V2::NumberInstance
- Defined in:
- lib/twilio-ruby/rest/pricing/v2/number.rb
Instance Method Summary collapse
-
#context ⇒ NumberContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#country ⇒ String
The name of the country.
-
#destination_number ⇒ String
The destination phone number in [E.164](www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number.
-
#fetch(origination_number: :unset) ⇒ NumberInstance
Fetch the NumberInstance.
-
#initialize(version, payload, destination_number: nil) ⇒ NumberInstance
constructor
Initialize the NumberInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#iso_country ⇒ String
The [ISO country code](en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
- #originating_call_price ⇒ PricingV2TrunkingNumberOriginatingCallPrice
-
#origination_number ⇒ String
The origination phone number in [[E.164](www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number..
-
#price_unit ⇒ String
The currency in which prices are measured, specified in [ISO 4127](www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. ‘usd`, `eur`, `jpy`).
- #terminating_prefix_prices ⇒ Array<PricingV2TrunkingCountryInstanceTerminatingPrefixPrices>
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#url ⇒ String
The absolute URL of the resource.
Constructor Details
#initialize(version, payload, destination_number: nil) ⇒ NumberInstance
Initialize the NumberInstance
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/twilio-ruby/rest/pricing/v2/number.rb', line 130 def initialize(version, payload , destination_number: nil) super(version) # Marshaled Properties @properties = { 'destination_number' => payload['destination_number'], 'origination_number' => payload['origination_number'], 'country' => payload['country'], 'iso_country' => payload['iso_country'], 'terminating_prefix_prices' => payload['terminating_prefix_prices'], 'originating_call_price' => payload['originating_call_price'], 'price_unit' => payload['price_unit'], 'url' => payload['url'], } # Context @instance_context = nil @params = { 'destination_number' => destination_number || @properties['destination_number'] , } end |
Instance Method Details
#context ⇒ NumberContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
154 155 156 157 158 159 |
# File 'lib/twilio-ruby/rest/pricing/v2/number.rb', line 154 def context unless @instance_context @instance_context = NumberContext.new(@version , @params['destination_number']) end @instance_context end |
#country ⇒ String
Returns The name of the country.
175 176 177 |
# File 'lib/twilio-ruby/rest/pricing/v2/number.rb', line 175 def country @properties['country'] end |
#destination_number ⇒ String
Returns The destination phone number in [E.164](www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number.
163 164 165 |
# File 'lib/twilio-ruby/rest/pricing/v2/number.rb', line 163 def destination_number @properties['destination_number'] end |
#fetch(origination_number: :unset) ⇒ NumberInstance
Fetch the NumberInstance
213 214 215 216 217 218 219 220 |
# File 'lib/twilio-ruby/rest/pricing/v2/number.rb', line 213 def fetch( origination_number: :unset ) context.fetch( origination_number: origination_number, ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
231 232 233 234 |
# File 'lib/twilio-ruby/rest/pricing/v2/number.rb', line 231 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Pricing.V2.NumberInstance #{values}>" end |
#iso_country ⇒ String
Returns The [ISO country code](en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
181 182 183 |
# File 'lib/twilio-ruby/rest/pricing/v2/number.rb', line 181 def iso_country @properties['iso_country'] end |
#originating_call_price ⇒ PricingV2TrunkingNumberOriginatingCallPrice
193 194 195 |
# File 'lib/twilio-ruby/rest/pricing/v2/number.rb', line 193 def originating_call_price @properties['originating_call_price'] end |
#origination_number ⇒ String
Returns The origination phone number in [[E.164](www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number.
169 170 171 |
# File 'lib/twilio-ruby/rest/pricing/v2/number.rb', line 169 def origination_number @properties['origination_number'] end |
#price_unit ⇒ String
Returns The currency in which prices are measured, specified in [ISO 4127](www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. ‘usd`, `eur`, `jpy`).
199 200 201 |
# File 'lib/twilio-ruby/rest/pricing/v2/number.rb', line 199 def price_unit @properties['price_unit'] end |
#terminating_prefix_prices ⇒ Array<PricingV2TrunkingCountryInstanceTerminatingPrefixPrices>
187 188 189 |
# File 'lib/twilio-ruby/rest/pricing/v2/number.rb', line 187 def terminating_prefix_prices @properties['terminating_prefix_prices'] end |
#to_s ⇒ Object
Provide a user friendly representation
224 225 226 227 |
# File 'lib/twilio-ruby/rest/pricing/v2/number.rb', line 224 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Pricing.V2.NumberInstance #{values}>" end |
#url ⇒ String
Returns The absolute URL of the resource.
205 206 207 |
# File 'lib/twilio-ruby/rest/pricing/v2/number.rb', line 205 def url @properties['url'] end |