Class: Telnyx::Resources::UserAddresses

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

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:



120
121
122
# File 'lib/telnyx/resources/user_addresses.rb', line 120

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 new user address from the provided details and returns the created 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:



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

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::UserAddressesUserAddress>

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

Returns a paginated list of your user addresses, with support for filtering and sorting.

Parameters:

Returns:

See Also:



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

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::UserAddressesUserAddress,
    options: options
  )
end

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

Retrieves the details of an existing user address.

Parameters:

Returns:

See Also:



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

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