class Twilio::REST::Pricing::V2::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}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] of the origin-based voice pricing information to fetch.
@return [CountryInstance] CountryInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/pricing/v2/country.rb 191 def initialize(version, payload, iso_country: nil) 192 super(version) 193 194 # Marshaled Properties 195 @properties = { 196 'country' => payload['country'], 197 'iso_country' => payload['iso_country'], 198 'terminating_prefix_prices' => payload['terminating_prefix_prices'], 199 'originating_call_prices' => payload['originating_call_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/v2/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/v2/country.rb 222 def country 223 @properties['country'] 224 end
Fetch the CountryInstance
@return [CountryInstance] Fetched CountryInstance
# File lib/twilio-ruby/rest/pricing/v2/country.rb 259 def fetch 260 context.fetch 261 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/pricing/v2/country.rb 272 def inspect 273 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 274 "<Twilio.Pricing.V2.CountryInstance #{values}>" 275 end
@return [String] The ISO country code
# File lib/twilio-ruby/rest/pricing/v2/country.rb 228 def iso_country 229 @properties['iso_country'] 230 end
@return [Array] The list of OriginatingCallPrice records
# File lib/twilio-ruby/rest/pricing/v2/country.rb 240 def originating_call_prices 241 @properties['originating_call_prices'] 242 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/v2/country.rb 246 def price_unit 247 @properties['price_unit'] 248 end
@return [Array] The list of TerminatingPrefixPrice records
# File lib/twilio-ruby/rest/pricing/v2/country.rb 234 def terminating_prefix_prices 235 @properties['terminating_prefix_prices'] 236 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/pricing/v2/country.rb 265 def to_s 266 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 267 "<Twilio.Pricing.V2.CountryInstance #{values}>" 268 end
@return [String] The absolute URL of the resource
# File lib/twilio-ruby/rest/pricing/v2/country.rb 252 def url 253 @properties['url'] 254 end