Class: Twilio::REST::Pricing::V1::VoiceList::NumberInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/pricing/v1/voice/number.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, number: nil) ⇒ NumberInstance

Initialize the NumberInstance

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 Number resource.

  • sid (String)

    The SID of the Call resource to fetch.



268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 268

def initialize(version, payload , number: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'number' => payload['number'],
        'country' => payload['country'],
        'iso_country' => payload['iso_country'],
        'outbound_call_price' => payload['outbound_call_price'],
        'inbound_call_price' => payload['inbound_call_price'],
        'price_unit' => payload['price_unit'],
        'url' => payload['url'],
    }

    # Context
    @instance_context = nil
    @params = { 'number' => number  || @properties['number']  , }
end

Instance Method Details

#contextNumberContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



292
293
294
295
296
297
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 292

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

#countryString

Returns The name of the country.

Returns:

  • (String)

    The name of the country.



307
308
309
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 307

def country
    @properties['country']
end

#fetchNumberInstance

Fetch the NumberInstance

Returns:



344
345
346
347
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 344

def fetch

    context.fetch
end

#inbound_call_pricePricingV1VoiceVoiceNumberInboundCallPrice

Returns:

  • (PricingV1VoiceVoiceNumberInboundCallPrice)


325
326
327
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 325

def inbound_call_price
    @properties['inbound_call_price']
end

#inspectObject

Provide a detailed, user friendly representation



358
359
360
361
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 358

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

#iso_countryString

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

Returns:



313
314
315
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 313

def iso_country
    @properties['iso_country']
end

#numberString

Returns The phone number.

Returns:

  • (String)

    The phone number.



301
302
303
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 301

def number
    @properties['number']
end

#outbound_call_pricePricingV1VoiceVoiceNumberOutboundCallPrice

Returns:

  • (PricingV1VoiceVoiceNumberOutboundCallPrice)


319
320
321
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 319

def outbound_call_price
    @properties['outbound_call_price']
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:



331
332
333
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 331

def price_unit
    @properties['price_unit']
end

#to_sObject

Provide a user friendly representation



351
352
353
354
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 351

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

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource.



337
338
339
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 337

def url
    @properties['url']
end