Class: Telnyx::Resources::SimCards

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

Overview

SIM Cards operations

Defined Under Namespace

Classes: Actions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ SimCards

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

Parameters:



244
245
246
247
# File 'lib/telnyx/resources/sim_cards.rb', line 244

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

Instance Attribute Details

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



8
9
10
# File 'lib/telnyx/resources/sim_cards.rb', line 8

def actions
  @actions
end

Instance Method Details

#delete(id, report_lost: nil, request_options: {}) ⇒ Telnyx::Models::SimCardDeleteResponse

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

The SIM card will be decommissioned, removed from your account and you will stop being charged.
The SIM card won't be able to connect to the network after the deletion is completed, thus making it impossible to consume data.
Transitioning to the disabled state may take a period of time. Until the transition is completed, the SIM card status will be disabling disabling.
In order to re-enable the SIM card, you will need to re-register it.

Parameters:

  • id (String)

    Identifies the SIM.

  • report_lost (Boolean)

    Enables deletion of disabled eSIMs that can't be uninstalled from a device. This

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

Returns:

See Also:



138
139
140
141
142
143
144
145
146
147
148
# File 'lib/telnyx/resources/sim_cards.rb', line 138

def delete(id, params = {})
  parsed, options = Telnyx::SimCardDeleteParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :delete,
    path: ["sim_cards/%1$s", id],
    query: query,
    model: Telnyx::Models::SimCardDeleteResponse,
    options: options
  )
end

#get_activation_code(id, request_options: {}) ⇒ Telnyx::Models::SimCardGetActivationCodeResponse

It returns the activation code for an eSIM.

This API is only available for eSIMs. If the given SIM is a physical SIM card, or has already been installed, an error will be returned.

Parameters:

Returns:

See Also:



163
164
165
166
167
168
169
170
# File 'lib/telnyx/resources/sim_cards.rb', line 163

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

#get_device_details(id, request_options: {}) ⇒ Telnyx::Models::SimCardGetDeviceDetailsResponse

It returns the device details where a SIM card is currently being used.

Parameters:

Returns:

See Also:



183
184
185
186
187
188
189
190
# File 'lib/telnyx/resources/sim_cards.rb', line 183

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

#get_public_ip(id, request_options: {}) ⇒ Telnyx::Models::SimCardGetPublicIPResponse

It returns the public IP requested for a SIM card.

Parameters:

Returns:

See Also:



203
204
205
206
207
208
209
210
# File 'lib/telnyx/resources/sim_cards.rb', line 203

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

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

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

Get all SIM cards belonging to the user that match the given filters.

Parameters:

  • filter (Telnyx::Models::SimCardListParams::Filter)

    Consolidated filter parameter for SIM cards (deepObject style). Originally: filt

  • filter_sim_card_group_id (String)

    A valid SIM card group ID.

  • include_sim_card_group (Boolean)

    It includes the associated SIM card group object in the response when present.

  • page_number (Integer)
  • page_size (Integer)
  • sort (Symbol, Telnyx::Models::SimCardListParams::Sort)

    Sorts SIM cards by the given field. Defaults to ascending order unless field is

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

Returns:

See Also:



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/telnyx/resources/sim_cards.rb', line 99

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

#list_wireless_connectivity_logs(id, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::SimCardListWirelessConnectivityLogsResponse>

This API allows listing a paginated collection of Wireless Connectivity Logs associated with a SIM Card, for troubleshooting purposes.

Parameters:

  • id (String)

    Identifies the SIM.

  • page_number (Integer)

    The page number to load.

  • page_size (Integer)

    The size of the page.

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

Returns:

See Also:



228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/telnyx/resources/sim_cards.rb', line 228

def list_wireless_connectivity_logs(id, params = {})
  parsed, options = Telnyx::SimCardListWirelessConnectivityLogsParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["sim_cards/%1$s/wireless_connectivity_logs", id],
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::Models::SimCardListWirelessConnectivityLogsResponse,
    options: options
  )
end

#retrieve(id, include_pin_puk_codes: nil, include_sim_card_group: nil, request_options: {}) ⇒ Telnyx::Models::SimCardRetrieveResponse

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

Returns the details regarding a specific SIM card.

Parameters:

  • id (String)

    Identifies the SIM.

  • include_pin_puk_codes (Boolean)

    When set to true, includes the PIN and PUK codes in the response. These codes ar

  • include_sim_card_group (Boolean)

    It includes the associated SIM card group object in the response when present.

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

Returns:

See Also:



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/telnyx/resources/sim_cards.rb', line 28

def retrieve(id, params = {})
  parsed, options = Telnyx::SimCardRetrieveParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["sim_cards/%1$s", id],
    query: query,
    model: Telnyx::Models::SimCardRetrieveResponse,
    options: options
  )
end

#update(sim_card_id, authorized_imeis: nil, data_limit: nil, sim_card_group_id: nil, status: nil, tags: nil, request_options: {}) ⇒ Telnyx::Models::SimCardUpdateResponse

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

Updates SIM card data

Parameters:

  • sim_card_id (String)

    Identifies the SIM.

  • authorized_imeis (Array<String>, nil)

    List of IMEIs authorized to use a given SIM card.

  • data_limit (Telnyx::Models::SimCard::DataLimit)

    The SIM card individual data limit configuration.

  • sim_card_group_id (String)

    The group SIMCardGroup identification. This attribute can be null w

  • status (Telnyx::Models::SimCardStatus)
  • tags (Array<String>)

    Searchable tags associated with the SIM card

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

Returns:

See Also:



64
65
66
67
68
69
70
71
72
73
# File 'lib/telnyx/resources/sim_cards.rb', line 64

def update(sim_card_id, params = {})
  parsed, options = Telnyx::SimCardUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["sim_cards/%1$s", sim_card_id],
    body: parsed,
    model: Telnyx::Models::SimCardUpdateResponse,
    options: options
  )
end