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 that created this Address resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 684

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'],
        'street_secondary' => payload['street_secondary'],
    }

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

Instance Method Details

#account_sidString

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

Returns:



726
727
728
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 726

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.



732
733
734
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 732

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:



717
718
719
720
721
722
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 717

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.This property has a maximum length of 16 4-byte characters, or 21 3-byte characters.

Returns:

  • (String)

    The name associated with the address.This property has a maximum length of 16 4-byte characters, or 21 3-byte characters.



738
739
740
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 738

def customer_name
    @properties['customer_name']
end

#date_createdTime

Returns The date and time in GMT that the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



744
745
746
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 744

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT that the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



750
751
752
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 750

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the AddressInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



823
824
825
826
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 823

def delete

    context.delete
end

#dependent_phone_numbersdependent_phone_numbers

Access the dependent_phone_numbers

Returns:



876
877
878
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 876

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.



798
799
800
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 798

def emergency_enabled
    @properties['emergency_enabled']
end

#fetchAddressInstance

Fetch the AddressInstance

Returns:



831
832
833
834
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 831

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.



756
757
758
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 756

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



889
890
891
892
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 889

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.



762
763
764
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 762

def iso_country
    @properties['iso_country']
end

#postal_codeString

Returns The postal code of the address.

Returns:

  • (String)

    The postal code of the address.



768
769
770
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 768

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.



774
775
776
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 774

def region
    @properties['region']
end

#sidString

Returns The unique string that that we created to identify the Address resource.

Returns:

  • (String)

    The unique string that that we created to identify the Address resource.



780
781
782
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 780

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.



786
787
788
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 786

def street
    @properties['street']
end

#street_secondaryString

Returns The additional number and street address of the address.

Returns:

  • (String)

    The additional number and street address of the address.



816
817
818
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 816

def street_secondary
    @properties['street_secondary']
end

#to_sObject

Provide a user friendly representation



882
883
884
885
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 882

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, street_secondary: :unset) ⇒ AddressInstance

Update the AddressInstance

Parameters:

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

    A descriptive string that you create to describe the new address. It can be up to 64 characters long for Regulatory Compliance addresses and 32 characters long for Emergency addresses.

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

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

    The additional number and street address of the address.

Returns:



848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 848

def update(
  friendly_name: :unset, 
  customer_name: :unset, 
  street: :unset, 
  city: :unset, 
  region: :unset, 
  postal_code: :unset, 
  emergency_enabled: :unset, 
  auto_correct_address: :unset, 
  street_secondary: :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, 
        street_secondary: street_secondary, 
    )
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`.



792
793
794
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 792

def uri
    @properties['uri']
end

#validatedBoolean

Returns Whether the address has been validated to comply with local regulation. In countries that require valid addresses, an invalid address will not be accepted. ‘true` indicates the Address has been validated. `false` indicate the country doesn’t require validation or the Address is not valid.

Returns:

  • (Boolean)

    Whether the address has been validated to comply with local regulation. In countries that require valid addresses, an invalid address will not be accepted. ‘true` indicates the Address has been validated. `false` indicate the country doesn’t require validation or the Address is not valid.



804
805
806
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 804

def validated
    @properties['validated']
end

#verifiedBoolean

Returns Whether the address has been verified to comply with regulation. In countries that require valid addresses, an invalid address will not be accepted. ‘true` indicates the Address has been verified. `false` indicate the country doesn’t require verified or the Address is not valid.

Returns:

  • (Boolean)

    Whether the address has been verified to comply with regulation. In countries that require valid addresses, an invalid address will not be accepted. ‘true` indicates the Address has been verified. `false` indicate the country doesn’t require verified or the Address is not valid.



810
811
812
# File 'lib/twilio-ruby/rest/api/v2010/account/address.rb', line 810

def verified
    @properties['verified']
end