Class: Twilio::REST::Pricing::V1::VoiceList::CountryInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/pricing/v1/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

  • iso_country (String) (defaults to: nil)

    The [ISO country code](en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the pricing information to fetch.



200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/twilio-ruby/rest/pricing/v1/voice/country.rb', line 200

def initialize(version, payload, iso_country: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'country' => payload['country'],
      'iso_country' => payload['iso_country'],
      'url' => payload['url'],
      'outbound_prefix_prices' => payload['outbound_prefix_prices'],
      'inbound_call_prices' => payload['inbound_call_prices'],
      'price_unit' => payload['price_unit'],
  }

  # 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:



222
223
224
225
226
227
# File 'lib/twilio-ruby/rest/pricing/v1/voice/country.rb', line 222

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



231
232
233
# File 'lib/twilio-ruby/rest/pricing/v1/voice/country.rb', line 231

def country
  @properties['country']
end

#fetchCountryInstance

Fetch a CountryInstance

Returns:



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

def fetch
  context.fetch
end

#inbound_call_pricesString

Returns The list of InboundCallPrice records.

Returns:

  • (String)

    The list of InboundCallPrice records



249
250
251
# File 'lib/twilio-ruby/rest/pricing/v1/voice/country.rb', line 249

def inbound_call_prices
  @properties['inbound_call_prices']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#iso_countryString

Returns The ISO country code.

Returns:

  • (String)

    The ISO country code



237
238
239
# File 'lib/twilio-ruby/rest/pricing/v1/voice/country.rb', line 237

def iso_country
  @properties['iso_country']
end

#outbound_prefix_pricesString

Returns The list of OutboundPrefixPrice records.

Returns:

  • (String)

    The list of OutboundPrefixPrice records



243
244
245
# File 'lib/twilio-ruby/rest/pricing/v1/voice/country.rb', line 243

def outbound_prefix_prices
  @properties['outbound_prefix_prices']
end

#price_unitString

Returns The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy).

Returns:

  • (String)

    The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy)



255
256
257
# File 'lib/twilio-ruby/rest/pricing/v1/voice/country.rb', line 255

def price_unit
  @properties['price_unit']
end

#to_sObject

Provide a user friendly representation



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

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

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource



261
262
263
# File 'lib/twilio-ruby/rest/pricing/v1/voice/country.rb', line 261

def url
  @properties['url']
end