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 [ISO-3166-1](en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country to fetch available phone number information about.



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 333

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 Whether all phone numbers available in the country are new to the Twilio platform.

Returns:

  • (Boolean)

    Whether all phone numbers available in the country are new to the Twilio platform.



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

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:



357
358
359
360
361
362
363
364
365
366
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 357

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

#countryString

Returns The name of the country.

Returns:

  • (String)

    The name of the country



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

def country
  @properties['country']
end

#country_codeString

Returns The ISO-3166-1 country code of the country.

Returns:

  • (String)

    The ISO-3166-1 country code of the country.



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

def country_code
  @properties['country_code']
end

#fetchAvailablePhoneNumberCountryInstance

Fetch a AvailablePhoneNumberCountryInstance

Returns:



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

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



463
464
465
466
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 463

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

#locallocal

Access the local

Returns:



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

def local
  context.local
end

#machine_to_machinemachine_to_machine

Access the machine_to_machine

Returns:



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

def machine_to_machine
  context.machine_to_machine
end

#mobilemobile

Access the mobile

Returns:



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

def mobile
  context.mobile
end

#nationalnational

Access the national

Returns:



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

def national
  context.national
end

#shared_costshared_cost

Access the shared_cost

Returns:



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

def shared_cost
  context.shared_cost
end

#subresource_urisString

Returns A list of related resources identified by their relative URIs.

Returns:

  • (String)

    A list of related resources identified by their relative URIs



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

def subresource_uris
  @properties['subresource_uris']
end

#to_sObject

Provide a user friendly representation



456
457
458
459
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 456

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:



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

def toll_free
  context.toll_free
end

#uriString

Returns The URI of the Country resource, relative to ‘api.twilio.com`.

Returns:

  • (String)

    The URI of the Country resource, relative to ‘api.twilio.com`



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

def uri
  @properties['uri']
end

#voipvoip

Access the voip

Returns:



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

def voip
  context.voip
end