Class: Telnyx::Resources::AlphanumericSenderIDs

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ AlphanumericSenderIDs

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

Parameters:



107
108
109
# File 'lib/telnyx/resources/alphanumeric_sender_ids.rb', line 107

def initialize(client:)
  @client = client
end

Instance Method Details

#create(alphanumeric_sender_id:, messaging_profile_id:, us_long_code_fallback: nil, request_options: {}) ⇒ Telnyx::Models::AlphanumericSenderIDCreateResponse

Create a new alphanumeric sender ID associated with a messaging profile.

Parameters:

  • alphanumeric_sender_id (String)

    The alphanumeric sender ID string.

  • messaging_profile_id (String)

    The messaging profile to associate the sender ID with.

  • us_long_code_fallback (String)

    A US long code number to use as fallback when sending to US destinations.

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

Returns:

See Also:



21
22
23
24
25
26
27
28
29
30
# File 'lib/telnyx/resources/alphanumeric_sender_ids.rb', line 21

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

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

Delete an alphanumeric sender ID and disassociate it from its messaging profile.

Parameters:

  • id (String)

    The identifier of the alphanumeric sender ID.

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

Returns:

See Also:



95
96
97
98
99
100
101
102
# File 'lib/telnyx/resources/alphanumeric_sender_ids.rb', line 95

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

#list(filter_messaging_profile_id: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::AlphanumericSenderID>

List all alphanumeric sender IDs for the authenticated user.

Parameters:

  • filter_messaging_profile_id (String)

    Filter by messaging profile ID.

  • page_number (Integer)

    Page number.

  • page_size (Integer)

    Page size.

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

Returns:

See Also:



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/telnyx/resources/alphanumeric_sender_ids.rb', line 67

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

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

Retrieve a specific alphanumeric sender ID.

Parameters:

  • id (String)

    The identifier of the alphanumeric sender ID.

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

Returns:

See Also:



43
44
45
46
47
48
49
50
# File 'lib/telnyx/resources/alphanumeric_sender_ids.rb', line 43

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