Class: Twilio::REST::Pricing::V1::MessagingList::CountryInstance

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



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 210

def initialize(version, payload , iso_country: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'country' => payload['country'],
        'iso_country' => payload['iso_country'],
        'outbound_sms_prices' => payload['outbound_sms_prices'],
        'inbound_sms_prices' => payload['inbound_sms_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:



232
233
234
235
236
237
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 232

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.



241
242
243
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 241

def country
    @properties['country']
end

#fetchCountryInstance

Fetch the CountryInstance

Returns:



278
279
280
281
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 278

def fetch

    context.fetch
end

#inbound_sms_pricesArray<PricingV1MessagingMessagingCountryInstanceInboundSmsPrices>

Returns The list of [InboundPrice](www.twilio.com/docs/sms/api/pricing#inbound-price) records that describe the price to receive an inbound SMS to the different Twilio phone number types supported in this country.

Returns:

  • (Array<PricingV1MessagingMessagingCountryInstanceInboundSmsPrices>)

    The list of [InboundPrice](www.twilio.com/docs/sms/api/pricing#inbound-price) records that describe the price to receive an inbound SMS to the different Twilio phone number types supported in this country



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

def inbound_sms_prices
    @properties['inbound_sms_prices']
end

#inspectObject

Provide a detailed, user friendly representation



292
293
294
295
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 292

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

#iso_countryString

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

Returns:



247
248
249
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 247

def iso_country
    @properties['iso_country']
end

#outbound_sms_pricesArray<PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices>

Returns The list of [OutboundSMSPrice](www.twilio.com/docs/sms/api/pricing#outbound-sms-price) records that represent the price to send a message for each MCC/MNC applicable in this country.

Returns:



253
254
255
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 253

def outbound_sms_prices
    @properties['outbound_sms_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:



265
266
267
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 265

def price_unit
    @properties['price_unit']
end

#to_sObject

Provide a user friendly representation



285
286
287
288
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 285

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.



271
272
273
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 271

def url
    @properties['url']
end