Class: Dodopayments::Resources::LicenseKeys

Inherits:
Object
  • Object
show all
Defined in:
lib/dodopayments/resources/license_keys.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ LicenseKeys

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

Parameters:



85
86
87
# File 'lib/dodopayments/resources/license_keys.rb', line 85

def initialize(client:)
  @client = client
end

Instance Method Details

#list(customer_id: nil, page_number: nil, page_size: nil, product_id: nil, status: nil, request_options: {}) ⇒ Dodopayments::Internal::DefaultPageNumberPagination<Dodopayments::Models::LicenseKey>

Parameters:

Returns:

See Also:



70
71
72
73
74
75
76
77
78
79
80
# File 'lib/dodopayments/resources/license_keys.rb', line 70

def list(params = {})
  parsed, options = Dodopayments::LicenseKeyListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "license_keys",
    query: parsed,
    page: Dodopayments::Internal::DefaultPageNumberPagination,
    model: Dodopayments::LicenseKey,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ Dodopayments::Models::LicenseKey

Parameters:

Returns:

See Also:



15
16
17
18
19
20
21
22
# File 'lib/dodopayments/resources/license_keys.rb', line 15

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

#update(id, activations_limit: nil, disabled: nil, expires_at: nil, request_options: {}) ⇒ Dodopayments::Models::LicenseKey

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

Parameters:

  • id (String)

    License key ID

  • activations_limit (Integer, nil)

    The updated activation limit for the license key.

  • disabled (Boolean, nil)

    Indicates whether the license key should be disabled.

  • expires_at (Time, nil)

    The updated expiration timestamp for the license key in UTC.

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

Returns:

See Also:



42
43
44
45
46
47
48
49
50
51
# File 'lib/dodopayments/resources/license_keys.rb', line 42

def update(id, params = {})
  parsed, options = Dodopayments::LicenseKeyUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["license_keys/%1$s", id],
    body: parsed,
    model: Dodopayments::LicenseKey,
    options: options
  )
end