Class: Twilio::REST::Pricing::V2::VoiceList::CountryInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/pricing/v2/voice/country.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, iso_country: nil) ⇒ CountryInstance

Initialize the CountryInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this Country resource.

  • sid (String)

    The SID of the Call resource to fetch.



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 220

def initialize(version, payload , iso_country: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'country' => payload['country'],
        'iso_country' => payload['iso_country'],
        'outbound_prefix_prices' => payload['outbound_prefix_prices'],
        'inbound_call_prices' => payload['inbound_call_prices'],
        'price_unit' => payload['price_unit'],
        'url' => payload['url'],
    }

    # Context
    @instance_context = nil
    @params = { 'iso_country' => iso_country  || @properties['iso_country']  , }
end

Instance Method Details

#contextCountryContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



242
243
244
245
246
247
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 242

def context
    unless @instance_context
        @instance_context = CountryContext.new(@version , @params['iso_country'])
    end
    @instance_context
end

#countryString

Returns The name of the country.

Returns:

  • (String)

    The name of the country.



251
252
253
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 251

def country
    @properties['country']
end

#fetchCountryInstance

Fetch the CountryInstance

Returns:



288
289
290
291
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 288

def fetch

    context.fetch
end

#inbound_call_pricesArray<PricingV2TrunkingCountryInstanceOriginatingCallPrices>

Returns The list of [InboundCallPrice](www.twilio.com/docs/voice/pricing#inbound-call-price) records.

Returns:



269
270
271
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 269

def inbound_call_prices
    @properties['inbound_call_prices']
end

#inspectObject

Provide a detailed, user friendly representation



302
303
304
305
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 302

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Pricing.V2.CountryInstance #{values}>"
end

#iso_countryString

Returns The [ISO country code](en.wikipedia.org/wiki/ISO_3166-1_alpha-2).

Returns:



257
258
259
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 257

def iso_country
    @properties['iso_country']
end

#outbound_prefix_pricesArray<PricingV2TrunkingCountryInstanceTerminatingPrefixPrices>

Returns The list of [OutboundPrefixPriceWithOrigin](www.twilio.com/docs/voice/pricing#outbound-prefix-price-with-origin) records.

Returns:



263
264
265
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 263

def outbound_prefix_prices
    @properties['outbound_prefix_prices']
end

#price_unitString

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`).

Returns:



275
276
277
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 275

def price_unit
    @properties['price_unit']
end

#to_sObject

Provide a user friendly representation



295
296
297
298
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 295

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Pricing.V2.CountryInstance #{values}>"
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource.



281
282
283
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 281

def url
    @properties['url']
end