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:



103
104
105
# File 'lib/stigg/resources/v1/customers/promotional_entitlements.rb', line 103

def initialize(client:)
  @client = client
end

Instance Method Details

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

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

Parameters:

Returns:

See Also:



23
24
25
26
27
28
29
30
31
32
# File 'lib/stigg/resources/v1/customers/promotional_entitlements.rb', line 23

def create(id, params)
  parsed, options = Stigg::V1::Customers::PromotionalEntitlementCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["api/v1/customers/%1$s/promotional-entitlements", id],
    body: parsed,
    model: Stigg::Models::V1::Customers::PromotionalEntitlementCreateResponse,
    options: options
  )
end

#list(id, after: nil, before: nil, created_at: nil, limit: nil, status: 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)

    The unique identifier of the entity

  • after (String)

    Return items that come after this cursor

  • before (String)

    Return items that come before this cursor

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

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

  • limit (Integer)

    Maximum number of items to return

  • status (String)

    Filter by promotional entitlement status. Supports comma-separated values for mu

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

Returns:

See Also:



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/stigg/resources/v1/customers/promotional_entitlements.rb', line 59

def list(id, params = {})
  parsed, options = Stigg::V1::Customers::PromotionalEntitlementListParams.dump_request(params)
  query = Stigg::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/v1/customers/%1$s/promotional-entitlements", id],
    query: query.transform_keys(created_at: "createdAt"),
    page: Stigg::Internal::MyCursorIDPage,
    model: Stigg::Models::V1::Customers::PromotionalEntitlementListResponse,
    options: options
  )
end

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

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

Parameters:

  • feature_id (String)

    The unique identifier of the entitlement feature

  • id (String)

    The unique identifier of the customer

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

Returns:

See Also:



86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/stigg/resources/v1/customers/promotional_entitlements.rb', line 86

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],
    model: Stigg::Models::V1::Customers::PromotionalEntitlementRevokeResponse,
    options: options
  )
end