Class: Stigg::Resources::V1::Customers::PromotionalEntitlements

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

Overview

Operations related to promotional entitlements

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ PromotionalEntitlements

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

Parameters:



134
135
136
# File 'lib/stigg/resources/v1/customers/promotional_entitlements.rb', line 134

def initialize(client:)
  @client = client
end

Instance Method Details

#create(id, promotional_entitlements:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Customers::PromotionalEntitlementCreateResponse

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

Grants promotional entitlements to a customer, providing feature access outside their subscription. Entitlements can be time-limited or permanent.

Parameters:

Returns:

See Also:



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/stigg/resources/v1/customers/promotional_entitlements.rb', line 31

def create(id, params)
  parsed, options = Stigg::V1::Customers::PromotionalEntitlementCreateParams.dump_request(params)
  header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"}
  @client.request(
    method: :post,
    path: ["api/v1/customers/%1$s/promotional-entitlements", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Stigg::Models::V1::Customers::PromotionalEntitlementCreateResponse,
    options: options
  )
end

#list(id, after: nil, before: nil, created_at: nil, limit: nil, status: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::Customers::PromotionalEntitlementListResponse>

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

Retrieves a paginated list of a customer’s promotional entitlements.

Parameters:

  • id (String)

    Path param: The unique identifier of the entity

  • after (String)

    Query param: Return items that come after this cursor

  • before (String)

    Query param: Return items that come before this cursor

  • created_at (Stigg::Models::V1::Customers::PromotionalEntitlementListParams::CreatedAt)

    Query param: Filter by creation date using range operators: gt, gte, lt, lte

  • limit (Integer)

    Query param: Maximum number of items to return

  • status (Array<Symbol, Stigg::Models::V1::Customers::PromotionalEntitlementListParams::Status>)

    Query param: Filter by promotional entitlement status. Supports comma-separated

  • x_account_id (String)

    Header param: Account ID — optional when authenticating with a user JWT (Bearer

  • x_environment_id (String)

    Header param: Environment ID — required when authenticating with a user JWT (Bea

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

Returns:

See Also:



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/stigg/resources/v1/customers/promotional_entitlements.rb', line 73

def list(id, params = {})
  query_params = [:after, :before, :created_at, :limit, :status]
  parsed, options = Stigg::V1::Customers::PromotionalEntitlementListParams.dump_request(params)
  query = Stigg::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: ["api/v1/customers/%1$s/promotional-entitlements", id],
    query: query.transform_keys(created_at: "createdAt"),
    headers: parsed.except(*query_params).transform_keys(
      x_account_id: "x-account-id",
      x_environment_id: "x-environment-id"
    ),
    page: Stigg::Internal::MyCursorIDPage,
    model: Stigg::Models::V1::Customers::PromotionalEntitlementListResponse,
    options: options
  )
end

#revoke(feature_id, id:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Customers::PromotionalEntitlementRevokeResponse

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

Revokes a previously granted promotional entitlement from a customer for a specific feature.

Parameters:

  • feature_id (String)

    Path param: The unique identifier of the entitlement feature

  • id (String)

    Path param: The unique identifier of the customer

  • x_account_id (String)

    Header param: Account ID — optional when authenticating with a user JWT (Bearer

  • x_environment_id (String)

    Header param: Environment ID — required when authenticating with a user JWT (Bea

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

Returns:

See Also:



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/stigg/resources/v1/customers/promotional_entitlements.rb', line 113

def revoke(feature_id, params)
  parsed, options = Stigg::V1::Customers::PromotionalEntitlementRevokeParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["api/v1/customers/%1$s/promotional-entitlements/%2$s", id, feature_id],
    headers: parsed.transform_keys(
      x_account_id: "x-account-id",
      x_environment_id: "x-environment-id"
    ),
    model: Stigg::Models::V1::Customers::PromotionalEntitlementRevokeResponse,
    options: options
  )
end