Class: Telnyx::Resources::Addresses
- Inherits:
-
Object
- Object
- Telnyx::Resources::Addresses
- Defined in:
- lib/telnyx/resources/addresses.rb,
lib/telnyx/resources/addresses/actions.rb
Overview
Operations to work with Address records. Address records are emergency-validated addresses meant to be associated with phone numbers. They are validated for emergency usage purposes at creation time, although you may validate them separately with a custom workflow using the ValidateAddress operation separately. Address records are not usable for physical orders, such as for Telnyx SIM cards, please use UserAddress for that. It is not possible to entirely skip emergency service validation for Address records; if an emergency provider for a phone number rejects the address then it cannot be used on a phone number. To prevent records from getting out of sync, Address records are immutable and cannot be altered once created. If you realize you need to alter an address, a new record must be created with the differing address.
Defined Under Namespace
Classes: Actions
Instance Attribute Summary collapse
-
#actions ⇒ Telnyx::Resources::Addresses::Actions
readonly
Operations to work with Address records.
Instance Method Summary collapse
-
#create(business_name:, country_code:, first_name:, last_name:, locality:, street_address:, address_book: nil, administrative_area: nil, borough: nil, customer_reference: nil, extended_address: nil, neighborhood: nil, phone_number: nil, postal_code: nil, validate_address: nil, request_options: {}) ⇒ Telnyx::Models::AddressCreateResponse
Some parameter documentations has been truncated, see Models::AddressCreateParams for more details.
-
#delete(id, request_options: {}) ⇒ Telnyx::Models::AddressDeleteResponse
Deletes an existing address.
-
#initialize(client:) ⇒ Addresses
constructor
private
A new instance of Addresses.
-
#list(filter: nil, page_number: nil, page_size: nil, sort: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::Address>
Some parameter documentations has been truncated, see Models::AddressListParams for more details.
-
#retrieve(id, request_options: {}) ⇒ Telnyx::Models::AddressRetrieveResponse
Retrieves the details of an existing address.
Constructor Details
#initialize(client:) ⇒ Addresses
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Addresses.
160 161 162 163 |
# File 'lib/telnyx/resources/addresses.rb', line 160 def initialize(client:) @client = client @actions = Telnyx::Resources::Addresses::Actions.new(client: client) end |
Instance Attribute Details
#actions ⇒ Telnyx::Resources::Addresses::Actions (readonly)
Operations to work with Address records. Address records are emergency-validated addresses meant to be associated with phone numbers. They are validated for emergency usage purposes at creation time, although you may validate them separately with a custom workflow using the ValidateAddress operation separately. Address records are not usable for physical orders, such as for Telnyx SIM cards, please use UserAddress for that. It is not possible to entirely skip emergency service validation for Address records; if an emergency provider for a phone number rejects the address then it cannot be used on a phone number. To prevent records from getting out of sync, Address records are immutable and cannot be altered once created. If you realize you need to alter an address, a new record must be created with the differing address.
29 30 31 |
# File 'lib/telnyx/resources/addresses.rb', line 29 def actions @actions end |
Instance Method Details
#create(business_name:, country_code:, first_name:, last_name:, locality:, street_address:, address_book: nil, administrative_area: nil, borough: nil, customer_reference: nil, extended_address: nil, neighborhood: nil, phone_number: nil, postal_code: nil, validate_address: nil, request_options: {}) ⇒ Telnyx::Models::AddressCreateResponse
Some parameter documentations has been truncated, see Models::AddressCreateParams for more details.
Creates an address.
73 74 75 76 77 78 79 80 81 82 |
# File 'lib/telnyx/resources/addresses.rb', line 73 def create(params) parsed, = Telnyx::AddressCreateParams.dump_request(params) @client.request( method: :post, path: "addresses", body: parsed, model: Telnyx::Models::AddressCreateResponse, options: ) end |
#delete(id, request_options: {}) ⇒ Telnyx::Models::AddressDeleteResponse
Deletes an existing address.
148 149 150 151 152 153 154 155 |
# File 'lib/telnyx/resources/addresses.rb', line 148 def delete(id, params = {}) @client.request( method: :delete, path: ["addresses/%1$s", id], model: Telnyx::Models::AddressDeleteResponse, options: params[:request_options] ) end |
#list(filter: nil, page_number: nil, page_size: nil, sort: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::Address>
Some parameter documentations has been truncated, see Models::AddressListParams for more details.
Returns a list of your addresses.
124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/telnyx/resources/addresses.rb', line 124 def list(params = {}) parsed, = Telnyx::AddressListParams.dump_request(params) query = Telnyx::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "addresses", query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"), page: Telnyx::Internal::DefaultFlatPagination, model: Telnyx::Address, options: ) end |
#retrieve(id, request_options: {}) ⇒ Telnyx::Models::AddressRetrieveResponse
Retrieves the details of an existing address.
95 96 97 98 99 100 101 102 |
# File 'lib/telnyx/resources/addresses.rb', line 95 def retrieve(id, params = {}) @client.request( method: :get, path: ["addresses/%1$s", id], model: Telnyx::Models::AddressRetrieveResponse, options: params[:request_options] ) end |