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

  • iso_country (String) (defaults to: nil)

    The iso_country



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 189

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

  # Marshaled Properties
  @properties = {
      'country' => payload['country'],
      'iso_country' => payload['iso_country'],
      'url' => payload['url'],
      'outbound_sms_prices' => payload['outbound_sms_prices'],
      'inbound_sms_prices' => payload['inbound_sms_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:



211
212
213
214
215
216
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 211

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



220
221
222
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 220

def country
  @properties['country']
end

#fetchCountryInstance

Fetch a CountryInstance

Returns:



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

def fetch
  context.fetch
end

#inbound_sms_pricesString

Returns List of InboundPrice records.

Returns:

  • (String)

    List of InboundPrice records



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

def inbound_sms_prices
  @properties['inbound_sms_prices']
end

#inspectObject

Provide a detailed, user friendly representation



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

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



226
227
228
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 226

def iso_country
  @properties['iso_country']
end

#outbound_sms_pricesString

Returns List of OutboundSMSPrice records.

Returns:

  • (String)

    List of OutboundSMSPrice records



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

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



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

def price_unit
  @properties['price_unit']
end

#to_sObject

Provide a user friendly representation



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

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

#urlString

Returns The url.

Returns:

  • (String)

    The url



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

def url
  @properties['url']
end