Class: Orb::Resources::Licenses::Usage

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Usage

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

Parameters:



89
90
91
# File 'lib/orb/resources/licenses/usage.rb', line 89

def initialize(client:)
  @client = client
end

Instance Method Details

#get_all_usage(license_type_id:, subscription_id:, cursor: nil, end_date: nil, group_by: nil, limit: nil, start_date: nil, request_options: {}) ⇒ Orb::Models::Licenses::UsageGetAllUsageResponse

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

Returns usage and remaining credits for all licenses of a given type on a subscription.

Date range defaults to the current billing period if not specified.

Parameters:

  • license_type_id (String)

    The license type ID to filter licenses by.

  • subscription_id (String)

    The subscription ID to get license usage for.

  • cursor (String, nil)

    Pagination cursor from a previous request.

  • end_date (Date, nil)

    End date for the usage period (YYYY-MM-DD). Defaults to end of current billing p

  • group_by (String, nil)

    How to group the results. Valid values: 'license', 'day'. Can be combined (e.g.,

  • limit (Integer)

    Maximum number of rows in the response data (default 20, max 100).

  • start_date (Date, nil)

    Start date for the usage period (YYYY-MM-DD). Defaults to start of current billi

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

Returns:

See Also:



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

def get_all_usage(params)
  parsed, options = Orb::Licenses::UsageGetAllUsageParams.dump_request(params)
  query = Orb::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "licenses/usage",
    query: query,
    model: Orb::Models::Licenses::UsageGetAllUsageResponse,
    options: options
  )
end

#get_usage(license_id, cursor: nil, end_date: nil, group_by: nil, limit: nil, start_date: nil, request_options: {}) ⇒ Orb::Models::Licenses::UsageGetUsageResponse

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

Returns usage and remaining credits for a specific license over a date range.

Date range defaults to the current billing period if not specified.

Parameters:

  • license_id (String)
  • cursor (String, nil)

    Pagination cursor from a previous request.

  • end_date (Date, nil)

    End date for the usage period (YYYY-MM-DD). Defaults to end of current billing p

  • group_by (String, nil)

    How to group the results. Valid values: 'license', 'day'. Can be combined (e.g.,

  • limit (Integer)

    Maximum number of rows in the response data (default 20, max 100).

  • start_date (Date, nil)

    Start date for the usage period (YYYY-MM-DD). Defaults to start of current billi

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

Returns:

See Also:



74
75
76
77
78
79
80
81
82
83
84
# File 'lib/orb/resources/licenses/usage.rb', line 74

def get_usage(license_id, params = {})
  parsed, options = Orb::Licenses::UsageGetUsageParams.dump_request(params)
  query = Orb::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["licenses/%1$s/usage", license_id],
    query: query,
    model: Orb::Models::Licenses::UsageGetUsageResponse,
    options: options
  )
end