Class: Telnyx::Resources::UserAddresses

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/user_addresses.rb

Overview

Operations for working with UserAddress records. UserAddress records are stored addresses that users can use for non-emergency-calling purposes, such as for shipping addresses for orders of wireless SIMs (or other physical items). They cannot be used for emergency calling and are distinct from Address records, which are used on phone numbers.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ UserAddresses

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

Parameters:



118
119
120
# File 'lib/telnyx/resources/user_addresses.rb', line 118

def initialize(client:)
  @client = client
end

Instance Method Details

#create(business_name:, country_code:, first_name:, last_name:, locality:, street_address:, administrative_area: nil, borough: nil, customer_reference: nil, extended_address: nil, neighborhood: nil, phone_number: nil, postal_code: nil, skip_address_verification: nil, request_options: {}) ⇒ Telnyx::Models::UserAddressCreateResponse

Some parameter documentations has been truncated, see Models::UserAddressCreateParams for more details.

Creates a user address.

Parameters:

  • business_name (String)

    The business name associated with the user address.

  • country_code (String)

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

  • first_name (String)

    The first name associated with the user address.

  • last_name (String)

    The last name associated with the user address.

  • locality (String)

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

  • street_address (String)

    The primary street address information about the user address.

  • administrative_area (String)

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

  • borough (String)

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

  • customer_reference (String)

    A customer reference string for customer look ups.

  • extended_address (String)

    Additional street address information about the user address such as, but not li

  • neighborhood (String)

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

  • phone_number (String)

    The phone number associated with the user address.

  • postal_code (String)

    The postal code of the user address.

  • skip_address_verification (Boolean)

    An optional boolean value specifying if verification of the address should be sk

  • 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/user_addresses.rb', line 51

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

#list(filter: nil, page_number: nil, page_size: nil, sort: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::UserAddress>

Some parameter documentations has been truncated, see Models::UserAddressListParams for more details.

Returns a list of your user addresses.

Parameters:

Returns:

See Also:



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

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

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

Retrieves the details of an existing user address.

Parameters:

Returns:

See Also:



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

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