Class: Twilio::REST::Api::V2010::AccountContext::AvailablePhoneNumberCountryInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, account_sid: nil, country_code: nil) ⇒ AvailablePhoneNumberCountryInstance

Initialize the AvailablePhoneNumberCountryInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String) (defaults to: nil)

    A 34 character string that uniquely identifies this resource.

  • country_code (String) (defaults to: nil)

    The country_code



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 320

def initialize(version, payload, account_sid: nil, country_code: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'country_code' => payload['country_code'],
      'country' => payload['country'],
      'uri' => payload['uri'],
      'beta' => payload['beta'],
      'subresource_uris' => payload['subresource_uris'],
  }

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

Instance Method Details

#betaBoolean

Returns True if new to Twilio platform.

Returns:

  • (Boolean)

    True if new to Twilio platform.



375
376
377
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 375

def beta
  @properties['beta']
end

#contextAvailablePhoneNumberCountryContext

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

Returns:



344
345
346
347
348
349
350
351
352
353
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 344

def context
  unless @instance_context
    @instance_context = AvailablePhoneNumberCountryContext.new(
        @version,
        @params['account_sid'],
        @params['country_code'],
    )
  end
  @instance_context
end

#countryString

Returns The country.

Returns:

  • (String)

    The country



363
364
365
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 363

def country
  @properties['country']
end

#country_codeString

Returns The ISO Country code to lookup phone numbers for.

Returns:

  • (String)

    The ISO Country code to lookup phone numbers for.



357
358
359
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 357

def country_code
  @properties['country_code']
end

#fetchAvailablePhoneNumberCountryInstance

Fetch a AvailablePhoneNumberCountryInstance

Returns:



388
389
390
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 388

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



450
451
452
453
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 450

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

#locallocal

Access the local

Returns:



395
396
397
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 395

def local
  context.local
end

#machine_to_machinemachine_to_machine

Access the machine_to_machine

Returns:



437
438
439
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 437

def machine_to_machine
  context.machine_to_machine
end

#mobilemobile

Access the mobile

Returns:



409
410
411
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 409

def mobile
  context.mobile
end

#nationalnational

Access the national

Returns:



416
417
418
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 416

def national
  context.national
end

#shared_costshared_cost

Access the shared_cost

Returns:



430
431
432
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 430

def shared_cost
  context.shared_cost
end

#subresource_urisString

Returns The subresource_uris.

Returns:

  • (String)

    The subresource_uris



381
382
383
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 381

def subresource_uris
  @properties['subresource_uris']
end

#to_sObject

Provide a user friendly representation



443
444
445
446
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 443

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

#toll_freetoll_free

Access the toll_free

Returns:



402
403
404
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 402

def toll_free
  context.toll_free
end

#uriString

Returns The uri.

Returns:

  • (String)

    The uri



369
370
371
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 369

def uri
  @properties['uri']
end

#voipvoip

Access the voip

Returns:



423
424
425
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 423

def voip
  context.voip
end