Class: Telnyx::Resources::Actions::Purchase

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

Overview

SIM Cards operations

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Purchase

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

Parameters:



49
50
51
# File 'lib/telnyx/resources/actions/purchase.rb', line 49

def initialize(client:)
  @client = client
end

Instance Method Details

#create(amount:, product: nil, sim_card_group_id: nil, status: nil, tags: nil, whitelabel_name: nil, request_options: {}) ⇒ Telnyx::Models::Actions::PurchaseCreateResponse

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

Purchases and registers the specified amount of eSIMs to the current user’s account.<br/><br/> If sim_card_group_id is provided, the eSIMs will be associated with that group. Otherwise, the default group for the current user will be used.<br/><br/>

Parameters:

  • amount (Integer)

    The amount of eSIMs to be purchased.

  • product (String)

    Type of product to be purchased, specify “whitelabel” to use a custom SPN

  • sim_card_group_id (String)

    The group SIMCardGroup identification. This attribute can be null w

  • status (Symbol, Telnyx::Models::Actions::PurchaseCreateParams::Status)

    Status on which the SIM cards will be set after being successfully registered.

  • tags (Array<String>)

    Searchable tags associated with the SIM cards

  • whitelabel_name (String)

    Service Provider Name (SPN) for the Whitelabel eSIM product. It will be displaye

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

Returns:

See Also:



35
36
37
38
39
40
41
42
43
44
# File 'lib/telnyx/resources/actions/purchase.rb', line 35

def create(params)
  parsed, options = Telnyx::Actions::PurchaseCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "actions/purchase/esims",
    body: parsed,
    model: Telnyx::Models::Actions::PurchaseCreateResponse,
    options: options
  )
end