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 unique id of the [Account](www.twilio.com/docs/iam/api/account) responsible for this address.

  • sid (String) (defaults to: nil)

    The sid



335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 335

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'],
  }

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

Instance Method Details

#account_sidString

Returns The unique id of the Account responsible for this address.

Returns:

  • (String)

    The unique id of the Account responsible for this address.



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

def 
  @properties['account_sid']
end

#cityString

Returns The city in which you or your customer is located.

Returns:

  • (String)

    The city in which you or your customer is located.



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

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:



365
366
367
368
369
370
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 365

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

#customer_nameString

Returns Your name or business name, or that of your customer.

Returns:

  • (String)

    Your name or business name, or that of your customer.



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

def customer_name
  @properties['customer_name']
end

#date_createdTime

Returns The date_created.

Returns:

  • (Time)

    The date_created



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

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date_updated.

Returns:

  • (Time)

    The date_updated



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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the AddressInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

def delete
  context.delete
end

#dependent_phone_numbersdependent_phone_numbers

Access the dependent_phone_numbers

Returns:



505
506
507
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 505

def dependent_phone_numbers
  context.dependent_phone_numbers
end

#emergency_enabledBoolean

Returns This is a value that indicates if emergency calling has been enabled on this number.

Returns:

  • (Boolean)

    This is a value that indicates if emergency calling has been enabled on this number.



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

def emergency_enabled
  @properties['emergency_enabled']
end

#fetchAddressInstance

Fetch a AddressInstance

Returns:



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

def fetch
  context.fetch
end

#friendly_nameString

Returns A human-readable description of the address.

Returns:

  • (String)

    A human-readable description of the address.



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

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



518
519
520
521
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 518

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

#iso_countryString

Returns The ISO country code of your or your customer’s address.

Returns:

  • (String)

    The ISO country code of your or your customer’s address.



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

def iso_country
  @properties['iso_country']
end

#postal_codeString

Returns The postal code in which you or your customer is located.

Returns:

  • (String)

    The postal code in which you or your customer is located.



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

def postal_code
  @properties['postal_code']
end

#regionString

Returns The state or region in which you or your customer is located.

Returns:

  • (String)

    The state or region in which you or your customer is located.



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

def region
  @properties['region']
end

#sidString

Returns A 34 character string that uniquely identifies this address.

Returns:

  • (String)

    A 34 character string that uniquely identifies this address.



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

def sid
  @properties['sid']
end

#streetString

Returns The number and street address where you or your customer is located.

Returns:

  • (String)

    The number and street address where you or your customer is located.



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

def street
  @properties['street']
end

#to_sObject

Provide a user friendly representation



511
512
513
514
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 511

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 human-readable description of the address. Maximum 64 characters.

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

    Your name or business name, or that of your customer.

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

    The number and street address where you or your customer is located.

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

    The city in which you or your customer is located.

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

    The state or region in which you or your customer is located.

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

    The postal code in which you or your customer is located.

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

    The emergency_enabled

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

    If you don’t set a value for this parameter, or if you set it to ‘true`, then the system will, if necessary, auto-correct the address you provide. If you don’t want the system to auto-correct the address, you will explicitly need to set this value to ‘false`.

Returns:



489
490
491
492
493
494
495
496
497
498
499
500
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 489

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 for this resource, relative to api.

Returns:

  • (String)

    The URI for this resource, relative to api.



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

def uri
  @properties['uri']
end

#validatedBoolean

Returns In some countries, addresses are validated to comply with local regulation.

Returns:

  • (Boolean)

    In some countries, addresses are validated to comply with local regulation.



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

def validated
  @properties['validated']
end