Class: Stigg::Resources::V1::Credits
- Inherits:
-
Object
- Object
- Stigg::Resources::V1::Credits
- Defined in:
- lib/stigg/resources/v1/credits.rb,
lib/stigg/resources/v1/credits/grants.rb,
lib/stigg/resources/v1/credits/custom_currencies.rb
Defined Under Namespace
Classes: CustomCurrencies, Grants
Instance Attribute Summary collapse
-
#custom_currencies ⇒ Stigg::Resources::V1::Credits::CustomCurrencies
readonly
Operations related to custom currencies.
-
#grants ⇒ Stigg::Resources::V1::Credits::Grants
readonly
Operations related to credit grants.
Instance Method Summary collapse
-
#get_auto_recharge(currency_id:, customer_id:, request_options: {}) ⇒ Stigg::Models::V1::CreditGetAutoRechargeResponse
Retrieves the automatic recharge configuration for a customer and currency.
-
#get_usage(customer_id:, currency_id: nil, end_date: nil, resource_id: nil, start_date: nil, time_range: nil, request_options: {}) ⇒ Stigg::Models::V1::CreditGetUsageResponse
Some parameter documentations has been truncated, see Models::V1::CreditGetUsageParams for more details.
-
#initialize(client:) ⇒ Credits
constructor
private
A new instance of Credits.
-
#list_ledger(customer_id:, after: nil, before: nil, currency_id: nil, limit: nil, resource_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::CreditListLedgerResponse>
Retrieves a paginated list of credit ledger events for a customer.
Constructor Details
#initialize(client:) ⇒ Credits
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 Credits.
126 127 128 129 130 |
# File 'lib/stigg/resources/v1/credits.rb', line 126 def initialize(client:) @client = client @grants = Stigg::Resources::V1::Credits::Grants.new(client: client) @custom_currencies = Stigg::Resources::V1::Credits::CustomCurrencies.new(client: client) end |
Instance Attribute Details
#custom_currencies ⇒ Stigg::Resources::V1::Credits::CustomCurrencies (readonly)
Operations related to custom currencies
13 14 15 |
# File 'lib/stigg/resources/v1/credits.rb', line 13 def custom_currencies @custom_currencies end |
#grants ⇒ Stigg::Resources::V1::Credits::Grants (readonly)
Operations related to credit grants
9 10 11 |
# File 'lib/stigg/resources/v1/credits.rb', line 9 def grants @grants end |
Instance Method Details
#get_auto_recharge(currency_id:, customer_id:, request_options: {}) ⇒ Stigg::Models::V1::CreditGetAutoRechargeResponse
Retrieves the automatic recharge configuration for a customer and currency. Returns default settings if no configuration exists.
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/stigg/resources/v1/credits.rb', line 29 def get_auto_recharge(params) parsed, = Stigg::V1::CreditGetAutoRechargeParams.dump_request(params) query = Stigg::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "api/v1/credits/auto-recharge", query: query.transform_keys(currency_id: "currencyId", customer_id: "customerId"), model: Stigg::Models::V1::CreditGetAutoRechargeResponse, options: ) end |
#get_usage(customer_id:, currency_id: nil, end_date: nil, resource_id: nil, start_date: nil, time_range: nil, request_options: {}) ⇒ Stigg::Models::V1::CreditGetUsageResponse
Some parameter documentations has been truncated, see Models::V1::CreditGetUsageParams for more details.
Retrieves credit usage time-series data for a customer, grouped by feature, over a specified time range.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/stigg/resources/v1/credits.rb', line 66 def get_usage(params) parsed, = Stigg::V1::CreditGetUsageParams.dump_request(params) query = Stigg::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "api/v1/credits/usage", query: query.transform_keys( customer_id: "customerId", currency_id: "currencyId", end_date: "endDate", resource_id: "resourceId", start_date: "startDate", time_range: "timeRange" ), model: Stigg::Models::V1::CreditGetUsageResponse, options: ) end |
#list_ledger(customer_id:, after: nil, before: nil, currency_id: nil, limit: nil, resource_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::CreditListLedgerResponse>
Retrieves a paginated list of credit ledger events for a customer.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/stigg/resources/v1/credits.rb', line 106 def list_ledger(params) parsed, = Stigg::V1::CreditListLedgerParams.dump_request(params) query = Stigg::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "api/v1/credits/ledger", query: query.transform_keys( customer_id: "customerId", currency_id: "currencyId", resource_id: "resourceId" ), page: Stigg::Internal::MyCursorIDPage, model: Stigg::Models::V1::CreditListLedgerResponse, options: ) end |