Class: Twilio::REST::Pricing::V1::PhoneNumberList::CountryInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb

Instance Method Summary collapse

Constructor Details

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

Initialize the CountryInstance



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

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

  # Marshaled Properties
  @properties = {
      'country' => payload['country'],
      'iso_country' => payload['iso_country'],
      'url' => payload['url'],
      'phone_number_prices' => payload['phone_number_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



208
209
210
211
212
213
# File 'lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb', line 208

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

#countryString



217
218
219
# File 'lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb', line 217

def country
  @properties['country']
end

#fetchCountryInstance

Fetch a CountryInstance



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

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#iso_countryString



223
224
225
# File 'lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb', line 223

def iso_country
  @properties['iso_country']
end

#phone_number_pricesString



229
230
231
# File 'lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb', line 229

def phone_number_prices
  @properties['phone_number_prices']
end

#price_unitString



235
236
237
# File 'lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb', line 235

def price_unit
  @properties['price_unit']
end

#to_sObject

Provide a user friendly representation



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

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

#urlString



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

def url
  @properties['url']
end