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

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

Overview

A coupon represents a reusable discount configuration that can be applied either as a fixed or percentage amount to an invoice or subscription. Coupons are activated using a redemption code, which applies the discount to a subscription or invoice. The duration of a coupon determines how long it remains available for use by end users.

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:



49
50
51
# File 'lib/orb/resources/coupons/subscriptions.rb', line 49

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 list, ordered starting from the most recently created subscription. For a full discussion of the subscription resource, see 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:



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/orb/resources/coupons/subscriptions.rb', line 33

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