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, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Subscriptions::UsageChargeUsageResponse
Some parameter documentations has been truncated, see Models::V1::Subscriptions::UsageChargeUsageParams for more details.
-
#initialize(client:) ⇒ Usage
constructor
private
A new instance of Usage.
-
#sync(id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Subscriptions::UsageSyncResponse
Some parameter documentations has been truncated, see Models::V1::Subscriptions::UsageSyncParams for more details.
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.
79 80 81 |
# File 'lib/stigg/resources/v1/subscriptions/usage.rb', line 79 def initialize(client:) @client = client end |
Instance Method Details
#charge_usage(id, until_date: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Subscriptions::UsageChargeUsageResponse
Some parameter documentations has been truncated, see Models::V1::Subscriptions::UsageChargeUsageParams for more details.
Immediately charges usage for a subscription via the billing integration. Calculates usage since the last charge and creates an invoice.
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/stigg/resources/v1/subscriptions/usage.rb', line 30 def charge_usage(id, params = {}) parsed, = Stigg::V1::Subscriptions::UsageChargeUsageParams.dump_request(params) header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"} @client.request( method: :post, path: ["api/v1/subscriptions/%1$s/usage/charge", id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Stigg::Models::V1::Subscriptions::UsageChargeUsageResponse, options: ) end |
#sync(id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Subscriptions::UsageSyncResponse
Some parameter documentations has been truncated, see Models::V1::Subscriptions::UsageSyncParams for more details.
Triggers a usage sync for a subscription, reporting current usage to the billing provider.
62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/stigg/resources/v1/subscriptions/usage.rb', line 62 def sync(id, params = {}) parsed, = Stigg::V1::Subscriptions::UsageSyncParams.dump_request(params) @client.request( method: :post, path: ["api/v1/subscriptions/%1$s/usage/sync", id], headers: parsed.transform_keys( x_account_id: "x-account-id", x_environment_id: "x-environment-id" ), model: Stigg::Models::V1::Subscriptions::UsageSyncResponse, options: ) end |