class Twilio::REST::Pricing::V1::VoiceList::NumberInstance
Public Class Methods
Initialize the NumberInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@param [String] number The phone number to fetch. @return [NumberInstance] NumberInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/pricing/v1/voice/number.rb 107 def initialize(version, payload, number: nil) 108 super(version) 109 110 # Marshaled Properties 111 @properties = { 112 'number' => payload['number'], 113 'country' => payload['country'], 114 'iso_country' => payload['iso_country'], 115 'outbound_call_price' => payload['outbound_call_price'], 116 'inbound_call_price' => payload['inbound_call_price'], 117 'price_unit' => payload['price_unit'], 118 'url' => payload['url'], 119 } 120 121 # Context 122 @instance_context = nil 123 @params = {'number' => number || @properties['number'], } 124 end
Public Instance Methods
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/v1/voice/number.rb 130 def context 131 unless @instance_context 132 @instance_context = NumberContext.new(@version, @params['number'], ) 133 end 134 @instance_context 135 end
@return [String] The name of the country
# File lib/twilio-ruby/rest/pricing/v1/voice/number.rb 145 def country 146 @properties['country'] 147 end
Fetch the NumberInstance
@return [NumberInstance] Fetched NumberInstance
# File lib/twilio-ruby/rest/pricing/v1/voice/number.rb 182 def fetch 183 context.fetch 184 end
@return [String] The InboundCallPrice record
# File lib/twilio-ruby/rest/pricing/v1/voice/number.rb 163 def inbound_call_price 164 @properties['inbound_call_price'] 165 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/pricing/v1/voice/number.rb 195 def inspect 196 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 197 "<Twilio.Pricing.V1.NumberInstance #{values}>" 198 end
@return [String] The ISO country code
# File lib/twilio-ruby/rest/pricing/v1/voice/number.rb 151 def iso_country 152 @properties['iso_country'] 153 end
@return [String] The phone number
# File lib/twilio-ruby/rest/pricing/v1/voice/number.rb 139 def number 140 @properties['number'] 141 end
@return [String] The OutboundCallPrice record
# File lib/twilio-ruby/rest/pricing/v1/voice/number.rb 157 def outbound_call_price 158 @properties['outbound_call_price'] 159 end
@return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy)
# File lib/twilio-ruby/rest/pricing/v1/voice/number.rb 169 def price_unit 170 @properties['price_unit'] 171 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/pricing/v1/voice/number.rb 188 def to_s 189 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 190 "<Twilio.Pricing.V1.NumberInstance #{values}>" 191 end
@return [String] The absolute URL of the resource
# File lib/twilio-ruby/rest/pricing/v1/voice/number.rb 175 def url 176 @properties['url'] 177 end