Class: Stigg::Resources::V1::Subscriptions::Usage
- Inherits:
-
Object
- Object
- Stigg::Resources::V1::Subscriptions::Usage
- Defined in:
- lib/stigg/resources/v1/subscriptions/usage.rb
Overview
Operations related to subscriptions
Instance Method Summary collapse
-
#charge_usage(id, until_date: nil, request_options: {}) ⇒ Stigg::Models::V1::Subscriptions::UsageChargeUsageResponse
Immediately charges usage for a subscription via the billing integration.
-
#initialize(client:) ⇒ Usage
constructor
private
A new instance of Usage.
-
#sync(id, request_options: {}) ⇒ Stigg::Models::V1::Subscriptions::UsageSyncResponse
Triggers a usage sync for a subscription, reporting current usage to the billing provider.
Constructor Details
#initialize(client:) ⇒ Usage
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 Usage.
58 59 60 |
# File 'lib/stigg/resources/v1/subscriptions/usage.rb', line 58 def initialize(client:) @client = client end |
Instance Method Details
#charge_usage(id, until_date: nil, request_options: {}) ⇒ Stigg::Models::V1::Subscriptions::UsageChargeUsageResponse
Immediately charges usage for a subscription via the billing integration. Calculates usage since the last charge and creates an invoice.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/stigg/resources/v1/subscriptions/usage.rb', line 23 def charge_usage(id, params = {}) parsed, = Stigg::V1::Subscriptions::UsageChargeUsageParams.dump_request(params) @client.request( method: :post, path: ["api/v1/subscriptions/%1$s/usage/charge", id], body: parsed, model: Stigg::Models::V1::Subscriptions::UsageChargeUsageResponse, options: ) end |
#sync(id, request_options: {}) ⇒ Stigg::Models::V1::Subscriptions::UsageSyncResponse
Triggers a usage sync for a subscription, reporting current usage to the billing provider.
46 47 48 49 50 51 52 53 |
# File 'lib/stigg/resources/v1/subscriptions/usage.rb', line 46 def sync(id, params = {}) @client.request( method: :post, path: ["api/v1/subscriptions/%1$s/usage/sync", id], model: Stigg::Models::V1::Subscriptions::UsageSyncResponse, options: params[:request_options] ) end |