class Twilio::REST::Pricing::V1::PhoneNumberList::CountryInstance
Public Class Methods
Initialize the CountryInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@param [String] iso_country
The {ISO country
code}[http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] of the pricing information to fetch.
@return [CountryInstance] CountryInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb 192 def initialize(version, payload, iso_country: nil) 193 super(version) 194 195 # Marshaled Properties 196 @properties = { 197 'country' => payload['country'], 198 'iso_country' => payload['iso_country'], 199 'phone_number_prices' => payload['phone_number_prices'], 200 'price_unit' => payload['price_unit'], 201 'url' => payload['url'], 202 } 203 204 # Context 205 @instance_context = nil 206 @params = {'iso_country' => iso_country || @properties['iso_country'], } 207 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 [CountryContext] CountryContext
for this CountryInstance
# File lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb 213 def context 214 unless @instance_context 215 @instance_context = CountryContext.new(@version, @params['iso_country'], ) 216 end 217 @instance_context 218 end
@return [String] The name of the country
# File lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb 222 def country 223 @properties['country'] 224 end
Fetch the CountryInstance
@return [CountryInstance] Fetched CountryInstance
# File lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb 253 def fetch 254 context.fetch 255 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb 266 def inspect 267 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 268 "<Twilio.Pricing.V1.CountryInstance #{values}>" 269 end
@return [String] The ISO country code
# File lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb 228 def iso_country 229 @properties['iso_country'] 230 end
@return [Array] The list of PhoneNumberPrices records
# File lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb 234 def phone_number_prices 235 @properties['phone_number_prices'] 236 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/phone_number/country.rb 240 def price_unit 241 @properties['price_unit'] 242 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb 259 def to_s 260 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 261 "<Twilio.Pricing.V1.CountryInstance #{values}>" 262 end
@return [String] The absolute URL of the resource
# File lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb 246 def url 247 @properties['url'] 248 end