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 account_sid

  • sid (String) (defaults to: nil)

    The sid



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

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 account_sid.

Returns:

  • (String)

    The account_sid



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

def 
  @properties['account_sid']
end

#cityString

Returns The city.

Returns:

  • (String)

    The city



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

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:



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

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

#customer_nameString

Returns The customer_name.

Returns:

  • (String)

    The customer_name



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

def customer_name
  @properties['customer_name']
end

#date_createdTime

Returns The date_created.

Returns:

  • (Time)

    The date_created



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

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date_updated.

Returns:

  • (Time)

    The date_updated



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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the AddressInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

def delete
  context.delete
end

#dependent_phone_numbersdependent_phone_numbers

Access the dependent_phone_numbers

Returns:



500
501
502
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 500

def dependent_phone_numbers
  context.dependent_phone_numbers
end

#emergency_enabledBoolean

Returns The emergency_enabled.

Returns:

  • (Boolean)

    The emergency_enabled



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

def emergency_enabled
  @properties['emergency_enabled']
end

#fetchAddressInstance

Fetch a AddressInstance

Returns:



469
470
471
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 469

def fetch
  context.fetch
end

#friendly_nameString

Returns The friendly_name.

Returns:

  • (String)

    The friendly_name



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

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#iso_countryString

Returns The iso_country.

Returns:

  • (String)

    The iso_country



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

def iso_country
  @properties['iso_country']
end

#postal_codeString

Returns The postal_code.

Returns:

  • (String)

    The postal_code



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

def postal_code
  @properties['postal_code']
end

#regionString

Returns The region.

Returns:

  • (String)

    The region



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

def region
  @properties['region']
end

#sidString

Returns The sid.

Returns:

  • (String)

    The sid



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

def sid
  @properties['sid']
end

#streetString

Returns The street.

Returns:

  • (String)

    The street



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

def street
  @properties['street']
end

#to_sObject

Provide a user friendly representation



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

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)

    The friendly_name

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

    The customer_name

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

    The street

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

    The city

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

    The region

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

    The postal_code

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

    The emergency_enabled

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

    The auto_correct_address

Returns:



484
485
486
487
488
489
490
491
492
493
494
495
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 484

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.

Returns:

  • (String)

    The uri



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

def uri
  @properties['uri']
end

#validatedBoolean

Returns The validated.

Returns:

  • (Boolean)

    The validated



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

def validated
  @properties['validated']
end