Class: Telnyx::Resources::Addresses

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/addresses.rb,
lib/telnyx/resources/addresses/actions.rb

Defined Under Namespace

Classes: Actions

Instance Attribute Summary collapse

Instance Method Summary collapse

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.

Parameters:



137
138
139
140
# File 'lib/telnyx/resources/addresses.rb', line 137

def initialize(client:)
  @client = client
  @actions = Telnyx::Resources::Addresses::Actions.new(client: client)
end

Instance Attribute Details

#actionsTelnyx::Resources::Addresses::Actions (readonly)



7
8
9
# File 'lib/telnyx/resources/addresses.rb', line 7

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.

Parameters:

  • business_name (String)

    The business name associated with the address. An address must have either a fir

  • country_code (String)

    The two-character (ISO 3166-1 alpha-2) country code of the address.

  • first_name (String)

    The first name associated with the address. An address must have either a first

  • last_name (String)

    The last name associated with the address. An address must have either a first l

  • locality (String)

    The locality of the address. For US addresses, this corresponds to the city of t

  • street_address (String)

    The primary street address information about the address.

  • address_book (Boolean)

    Indicates whether or not the address should be considered part of your list of a

  • administrative_area (String)

    The locality of the address. For US addresses, this corresponds to the state of

  • borough (String)

    The borough of the address. This field is not used for addresses in the US but i

  • customer_reference (String)

    A customer reference string for customer look ups.

  • extended_address (String)

    Additional street address information about the address such as, but not limited

  • neighborhood (String)

    The neighborhood of the address. This field is not used for addresses in the US

  • phone_number (String)

    The phone number associated with the address.

  • postal_code (String)

    The postal code of the address.

  • validate_address (Boolean)

    Indicates whether or not the address should be validated for emergency use upon

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



51
52
53
54
55
56
57
58
59
60
# File 'lib/telnyx/resources/addresses.rb', line 51

def create(params)
  parsed, options = Telnyx::AddressCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "addresses",
    body: parsed,
    model: Telnyx::Models::AddressCreateResponse,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ Telnyx::Models::AddressDeleteResponse

Deletes an existing address.

Parameters:

Returns:

See Also:



125
126
127
128
129
130
131
132
# File 'lib/telnyx/resources/addresses.rb', line 125

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.

Parameters:

Returns:

See Also:



102
103
104
105
106
107
108
109
110
111
112
# File 'lib/telnyx/resources/addresses.rb', line 102

def list(params = {})
  parsed, options = Telnyx::AddressListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "addresses",
    query: parsed.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::Address,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ Telnyx::Models::AddressRetrieveResponse

Retrieves the details of an existing address.

Parameters:

Returns:

See Also:



73
74
75
76
77
78
79
80
# File 'lib/telnyx/resources/addresses.rb', line 73

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["addresses/%1$s", id],
    model: Telnyx::Models::AddressRetrieveResponse,
    options: params[:request_options]
  )
end