Class: Twilio::REST::Api::V2010::AccountContext::AddressInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, account_sid: nil, sid: nil) ⇒ AddressInstance

Initialize the AddressInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String) (defaults to: nil)

    The SID of the [Account](www.twilio.com/docs/api/rest/account) that is responsible for the Address resource.

  • sid (String) (defaults to: nil)

    The Twilio-provided string that uniquely identifies the Address resource to fetch.



342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 342

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

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'city' => payload['city'],
      'customer_name' => payload['customer_name'],
      'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
      'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
      'friendly_name' => payload['friendly_name'],
      'iso_country' => payload['iso_country'],
      'postal_code' => payload['postal_code'],
      'region' => payload['region'],
      'sid' => payload['sid'],
      'street' => payload['street'],
      'uri' => payload['uri'],
      'emergency_enabled' => payload['emergency_enabled'],
      'validated' => payload['validated'],
      'verified' => payload['verified'],
  }

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

Instance Method Details

#account_sidString

Returns The SID of the Account that is responsible for the resource.

Returns:

  • (String)

    The SID of the Account that is responsible for the resource



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

def 
  @properties['account_sid']
end

#cityString

Returns The city in which the address is located.

Returns:

  • (String)

    The city in which the address is located



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

def city
  @properties['city']
end

#contextAddressContext

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

Returns:



373
374
375
376
377
378
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 373

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

#customer_nameString

Returns The name associated with the address.

Returns:

  • (String)

    The name associated with the address



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

def customer_name
  @properties['customer_name']
end

#date_createdTime

Returns The RFC 2822 date and time in GMT that the resource was created.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT that the resource was created



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

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The RFC 2822 date and time in GMT that the resource was last updated.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT that the resource was last updated



406
407
408
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 406

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the AddressInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



473
474
475
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 473

def delete
  context.delete
end

#dependent_phone_numbersdependent_phone_numbers

Access the dependent_phone_numbers

Returns:



516
517
518
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 516

def dependent_phone_numbers
  context.dependent_phone_numbers
end

#emergency_enabledBoolean

Returns Whether emergency calling has been enabled on this number.

Returns:

  • (Boolean)

    Whether emergency calling has been enabled on this number



454
455
456
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 454

def emergency_enabled
  @properties['emergency_enabled']
end

#fetchAddressInstance

Fetch a AddressInstance

Returns:



480
481
482
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 480

def fetch
  context.fetch
end

#friendly_nameString

Returns The string that you assigned to describe the resource.

Returns:

  • (String)

    The string that you assigned to describe the resource



412
413
414
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 412

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



529
530
531
532
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 529

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

#iso_countryString

Returns The ISO country code of the address.

Returns:

  • (String)

    The ISO country code of the address



418
419
420
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 418

def iso_country
  @properties['iso_country']
end

#postal_codeString

Returns The postal code of the address.

Returns:

  • (String)

    The postal code of the address



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

def postal_code
  @properties['postal_code']
end

#regionString

Returns The state or region of the address.

Returns:

  • (String)

    The state or region of the address



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

def region
  @properties['region']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource



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

def sid
  @properties['sid']
end

#streetString

Returns The number and street address of the address.

Returns:

  • (String)

    The number and street address of the address



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

def street
  @properties['street']
end

#to_sObject

Provide a user friendly representation



522
523
524
525
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 522

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

#update(friendly_name: :unset, customer_name: :unset, street: :unset, city: :unset, region: :unset, postal_code: :unset, emergency_enabled: :unset, auto_correct_address: :unset) ⇒ AddressInstance

Update the AddressInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)

    A descriptive string that you create to describe the address. It can be up to 64 characters long.

  • customer_name (String) (defaults to: :unset)

    The name to associate with the address.

  • street (String) (defaults to: :unset)

    The number and street address of the address.

  • city (String) (defaults to: :unset)

    The city of the address.

  • region (String) (defaults to: :unset)

    The state or region of the address.

  • postal_code (String) (defaults to: :unset)

    The postal code of the address.

  • emergency_enabled (Boolean) (defaults to: :unset)

    Whether to enable emergency calling on the address. Can be: ‘true` or `false`.

  • auto_correct_address (Boolean) (defaults to: :unset)

    Whether we should automatically correct the address. Can be: ‘true` or `false` and the default is `true`. If empty or `true`, we will correct the address you provide if necessary. If `false`, we won’t alter the address you provide.

Returns:



500
501
502
503
504
505
506
507
508
509
510
511
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 500

def update(friendly_name: :unset, customer_name: :unset, street: :unset, city: :unset, region: :unset, postal_code: :unset, emergency_enabled: :unset, auto_correct_address: :unset)
  context.update(
      friendly_name: friendly_name,
      customer_name: customer_name,
      street: street,
      city: city,
      region: region,
      postal_code: postal_code,
      emergency_enabled: emergency_enabled,
      auto_correct_address: auto_correct_address,
  )
end

#uriString

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

Returns:

  • (String)

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



448
449
450
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 448

def uri
  @properties['uri']
end

#validatedBoolean

Returns Whether the address has been validated to comply with local regulation.

Returns:

  • (Boolean)

    Whether the address has been validated to comply with local regulation



460
461
462
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 460

def validated
  @properties['validated']
end

#verifiedBoolean

Returns Whether the address has been verified to comply with regulation.

Returns:

  • (Boolean)

    Whether the address has been verified to comply with regulation



466
467
468
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 466

def verified
  @properties['verified']
end