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

  • iso_country (String) (defaults to: nil)

    This fetches the origin-based voice pricing information for a specific country



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 191

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:



213
214
215
216
217
218
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 213

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

#countryString

Returns Name of the country.

Returns:

  • (String)

    Name of the country



222
223
224
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 222

def country
  @properties['country']
end

#fetchCountryInstance

Fetch a CountryInstance

Returns:



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

def fetch
  context.fetch
end

#inbound_call_pricesString

Returns List of InboundCallPrice records.

Returns:

  • (String)

    List of InboundCallPrice records



240
241
242
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 240

def inbound_call_prices
  @properties['inbound_call_prices']
end

#inspectObject

Provide a detailed, user friendly representation



272
273
274
275
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 272

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

#iso_countryString

Returns The ISO country code.

Returns:

  • (String)

    The ISO country code



228
229
230
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 228

def iso_country
  @properties['iso_country']
end

#outbound_prefix_pricesString

Returns List of OutboundPrefixPriceWithOrigin records.

Returns:

  • (String)

    List of OutboundPrefixPriceWithOrigin records



234
235
236
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 234

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



246
247
248
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 246

def price_unit
  @properties['price_unit']
end

#to_sObject

Provide a user friendly representation



265
266
267
268
# File 'lib/twilio-ruby/rest/pricing/v2/voice/country.rb', line 265

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

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



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

def url
  @properties['url']
end