Class: Orb::Resources::Licenses

Inherits:
Object
  • Object
show all
Defined in:
lib/orb/resources/licenses.rb,
lib/orb/resources/licenses/usage.rb,
lib/orb/resources/licenses/external_licenses.rb,
sig/orb/resources/licenses.rbs,
sig/orb/resources/licenses/usage.rbs,
sig/orb/resources/licenses/external_licenses.rbs

Defined Under Namespace

Classes: ExternalLicenses, Usage

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Licenses

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

Parameters:



166
167
168
169
170
# File 'lib/orb/resources/licenses.rb', line 166

def initialize(client:)
  @client = client
  @external_licenses = Orb::Resources::Licenses::ExternalLicenses.new(client: client)
  @usage = Orb::Resources::Licenses::Usage.new(client: client)
end

Instance Attribute Details

#external_licensesOrb::Resources::Licenses::ExternalLicenses (readonly)



7
8
9
# File 'lib/orb/resources/licenses.rb', line 7

def external_licenses
  @external_licenses
end

#usageOrb::Resources::Licenses::Usage (readonly)



10
11
12
# File 'lib/orb/resources/licenses.rb', line 10

def usage
  @usage
end

Instance Method Details

#create(external_license_id:, license_type_id:, subscription_id:, end_date: nil, start_date: nil, request_options: {}) ⇒ Orb::Models::LicenseCreateResponse

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

This endpoint is used to create a new license for a user.

If a start date is provided, the license will be activated at the start of the specified date in the customer's timezone. Otherwise, the activation time will default to the start of the current day in the customer's timezone.

Parameters:

  • external_license_id (String)

    The external identifier for the license.

  • license_type_id (String)
  • subscription_id (String)
  • end_date (Date, nil)

    The end date of the license. If not provided, the license will remain active unt

  • start_date (Date, nil)

    The start date of the license. If not provided, defaults to start of day today i

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

Returns:

See Also:



38
39
40
41
42
43
44
45
46
47
# File 'lib/orb/resources/licenses.rb', line 38

def create(params)
  parsed, options = Orb::LicenseCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "licenses",
    body: parsed,
    model: Orb::Models::LicenseCreateResponse,
    options: options
  )
end

#deactivate(license_id, end_date: nil, request_options: {}) ⇒ Orb::Models::LicenseDeactivateResponse

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

This endpoint is used to deactivate an existing license.

If an end date is provided, the license will be deactivated at the start of the specified date in the customer's timezone. Otherwise, the deactivation time will default to the end of the current day in the customer's timezone.

Parameters:

  • license_id (String)
  • end_date (Date, nil)

    The date to deactivate the license. If not provided, defaults to end of day toda

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

Returns:

See Also:



125
126
127
128
129
130
131
132
133
134
# File 'lib/orb/resources/licenses.rb', line 125

def deactivate(license_id, params = {})
  parsed, options = Orb::LicenseDeactivateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["licenses/%1$s/deactivate", license_id],
    body: parsed,
    model: Orb::Models::LicenseDeactivateResponse,
    options: options
  )
end

#list(subscription_id:, cursor: nil, external_license_id: nil, license_type_id: nil, limit: nil, status: nil, request_options: {}) ⇒ Orb::Internal::Page<Orb::Models::LicenseListResponse>

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

This endpoint returns a list of all licenses for a subscription.

Parameters:

  • subscription_id (String)
  • cursor (String, nil)

    Cursor for pagination. This can be populated by the next_cursor value returned

  • external_license_id (String, nil)
  • license_type_id (String, nil)
  • limit (Integer)

    The number of items to fetch. Defaults to 20.

  • status (Symbol, Orb::Models::LicenseListParams::Status, nil)
  • request_options (Orb::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/orb/resources/licenses.rb', line 92

def list(params)
  parsed, options = Orb::LicenseListParams.dump_request(params)
  query = Orb::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "licenses",
    query: query,
    page: Orb::Internal::Page,
    model: Orb::Models::LicenseListResponse,
    options: options
  )
end

#retrieve(license_id, request_options: {}) ⇒ Orb::Models::LicenseRetrieveResponse

This endpoint is used to fetch a license given an identifier.

Parameters:

Returns:

See Also:



59
60
61
62
63
64
65
66
# File 'lib/orb/resources/licenses.rb', line 59

def retrieve(license_id, params = {})
  @client.request(
    method: :get,
    path: ["licenses/%1$s", license_id],
    model: Orb::Models::LicenseRetrieveResponse,
    options: params[:request_options]
  )
end

#retrieve_by_external_id(external_license_id, license_type_id:, subscription_id:, request_options: {}) ⇒ Orb::Models::LicenseRetrieveByExternalIDResponse

This endpoint is used to fetch a license given an external license identifier.

Parameters:

  • external_license_id (String)
  • license_type_id (String)

    The ID of the license type to fetch the license for.

  • subscription_id (String)

    The ID of the subscription to fetch the license for.

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

Returns:

See Also:



151
152
153
154
155
156
157
158
159
160
161
# File 'lib/orb/resources/licenses.rb', line 151

def retrieve_by_external_id(external_license_id, params)
  parsed, options = Orb::LicenseRetrieveByExternalIDParams.dump_request(params)
  query = Orb::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["licenses/external_license_id/%1$s", external_license_id],
    query: query,
    model: Orb::Models::LicenseRetrieveByExternalIDResponse,
    options: options
  )
end