Class: Orb::Resources::Coupons::Subscriptions

Inherits:
Object
  • Object
show all
Defined in:
lib/orb/resources/coupons/subscriptions.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Subscriptions

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

Parameters:



43
44
45
# File 'lib/orb/resources/coupons/subscriptions.rb', line 43

def initialize(client:)
  @client = client
end

Instance Method Details

#list(coupon_id, cursor: nil, limit: nil, request_options: {}) ⇒ Orb::Internal::Page<Orb::Models::Subscription>

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

This endpoint returns a list of all subscriptions that have redeemed a given coupon as a [paginated](/api-reference/pagination) list, ordered starting from the most recently created subscription. For a full discussion of the subscription resource, see [Subscription](/core-concepts#subscription).

Parameters:

  • coupon_id (String)
  • cursor (String, nil)

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

  • limit (Integer)

    The number of items to fetch. Defaults to 20.

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

Returns:

See Also:



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/orb/resources/coupons/subscriptions.rb', line 28

def list(coupon_id, params = {})
  parsed, options = Orb::Coupons::SubscriptionListParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["coupons/%1$s/subscriptions", coupon_id],
    query: parsed,
    page: Orb::Internal::Page,
    model: Orb::Subscription,
    options: options
  )
end