Class: Stigg::Resources::V1::Events::Beta::Customers::Entitlements

Inherits:
Object
  • Object
show all
Defined in:
lib/stigg/resources/v1/events/beta/customers/entitlements.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Entitlements

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

Parameters:



60
61
62
# File 'lib/stigg/resources/v1/events/beta/customers/entitlements.rb', line 60

def initialize(client:)
  @client = client
end

Instance Method Details

#check(id, currency_id: nil, dimensions: nil, feature_id: nil, requested_usage: nil, requested_values: nil, resource_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Events::Beta::Customers::EntitlementCheckResponse

Some parameter documentations has been truncated, see Models::V1::Events::Beta::Customers::EntitlementCheckParams for more details.

Experimental — request and response shapes may change without notice. Same semantics as ‘Check entitlement`, plus an optional `dimensions` query param that resolves to per-entity governance limits surfaced as `chains` on the response.

Parameters:

  • id (String)

    The unique identifier of the entity

  • currency_id (String)

    Currency ID (refId) to check for credit entitlements. Mutually exclusive with ‘f

  • dimensions (Hash{Symbol=>String})

    Optional attribution map (e.g. ‘dimensions=u1`). When provided, the resp

  • feature_id (String)

    Feature ID (refId) to check. Mutually exclusive with ‘currencyId`.

  • requested_usage (Integer)

    Requested usage amount to evaluate against the entitlement limit (numeric featur

  • requested_values (Array<String>)

    Requested values to evaluate against allowed values (enum features only)

  • resource_id (String)

    Resource ID to scope the entitlement check to a specific resource

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

Returns:

See Also:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/stigg/resources/v1/events/beta/customers/entitlements.rb', line 39

def check(id, params = {})
  parsed, options = Stigg::V1::Events::Beta::Customers::EntitlementCheckParams.dump_request(params)
  query = Stigg::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/v1-beta/customers/%1$s/entitlements/check", id],
    query: query.transform_keys(
      currency_id: "currencyId",
      feature_id: "featureId",
      requested_usage: "requestedUsage",
      requested_values: "requestedValues",
      resource_id: "resourceId"
    ),
    model: Stigg::Models::V1::Events::Beta::Customers::EntitlementCheckResponse,
    options: options
  )
end