Class: Stigg::Resources::V1::Credits::Consumption
- Inherits:
-
Object
- Object
- Stigg::Resources::V1::Credits::Consumption
- Defined in:
- lib/stigg/resources/v1/credits/consumption.rb,
sig/stigg/resources/v1/credits/consumption.rbs
Instance Method Summary collapse
-
#consume(amount:, currency_id:, customer_id:, idempotency_key:, created_at: nil, dimensions: nil, resource_id: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Credits::ConsumptionConsumeResponse
Some parameter documentations has been truncated, see Models::V1::Credits::ConsumptionConsumeParams for more details.
-
#consume_async(consumptions:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Credits::ConsumptionConsumeAsyncResponse
Some parameter documentations has been truncated, see Models::V1::Credits::ConsumptionConsumeAsyncParams for more details.
-
#initialize(client:) ⇒ Consumption
constructor
private
A new instance of Consumption.
Constructor Details
#initialize(client:) ⇒ Consumption
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 Consumption.
87 88 89 |
# File 'lib/stigg/resources/v1/credits/consumption.rb', line 87 def initialize(client:) @client = client end |
Instance Method Details
#consume(amount:, currency_id:, customer_id:, idempotency_key:, created_at: nil, dimensions: nil, resource_id: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Credits::ConsumptionConsumeResponse
Some parameter documentations has been truncated, see Models::V1::Credits::ConsumptionConsumeParams for more details.
Consumes a specified amount of credits directly from a customer wallet, with no feature mapping. Returns the optimistic balance.
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/stigg/resources/v1/credits/consumption.rb', line 39 def consume(params) parsed, = Stigg::V1::Credits::ConsumptionConsumeParams.dump_request(params) header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"} @client.request( method: :post, path: "api/v1/credits/consumption", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Stigg::Models::V1::Credits::ConsumptionConsumeResponse, options: ) end |
#consume_async(consumptions:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Credits::ConsumptionConsumeAsyncResponse
Some parameter documentations has been truncated, see Models::V1::Credits::ConsumptionConsumeAsyncParams for more details.
Consumes credits directly from customer wallets asynchronously. Consumptions are reconciled asynchronously into the credit balances.
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/stigg/resources/v1/credits/consumption.rb', line 71 def consume_async(params) parsed, = Stigg::V1::Credits::ConsumptionConsumeAsyncParams.dump_request(params) header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"} @client.request( method: :post, path: "api/v1/credits/consumption/async", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Stigg::Models::V1::Credits::ConsumptionConsumeAsyncResponse, options: ) end |