Class: Stigg::Resources::V1::Events::Credits::Grants
- Inherits:
-
Object
- Object
- Stigg::Resources::V1::Events::Credits::Grants
- Defined in:
- lib/stigg/resources/v1/events/credits/grants.rb
Overview
Operations related to credit grants
Instance Method Summary collapse
-
#create(amount:, currency_id:, customer_id:, display_name:, grant_type:, await_payment_confirmation: nil, billing_information: nil, comment: nil, cost: nil, effective_at: nil, expire_at: nil, metadata: nil, payment_collection_method: nil, priority: nil, resource_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Events::Credits::CreditGrantResponse
Creates a new credit grant for a customer with specified amount, type, and optional billing configuration.
-
#initialize(client:) ⇒ Grants
constructor
private
A new instance of Grants.
-
#list(customer_id:, after: nil, before: nil, created_at: nil, currency_id: nil, limit: nil, resource_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::Events::Credits::GrantListResponse>
Some parameter documentations has been truncated, see Models::V1::Events::Credits::GrantListParams for more details.
-
#void(id, request_options: {}) ⇒ Stigg::Models::V1::Events::Credits::CreditGrantResponse
Voids an existing credit grant, preventing further consumption of the remaining credits.
Constructor Details
#initialize(client:) ⇒ Grants
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 Grants.
129 130 131 |
# File 'lib/stigg/resources/v1/events/credits/grants.rb', line 129 def initialize(client:) @client = client end |
Instance Method Details
#create(amount:, currency_id:, customer_id:, display_name:, grant_type:, await_payment_confirmation: nil, billing_information: nil, comment: nil, cost: nil, effective_at: nil, expire_at: nil, metadata: nil, payment_collection_method: nil, priority: nil, resource_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Events::Credits::CreditGrantResponse
Creates a new credit grant for a customer with specified amount, type, and optional billing configuration.
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/stigg/resources/v1/events/credits/grants.rb', line 50 def create(params) parsed, = Stigg::V1::Events::Credits::GrantCreateParams.dump_request(params) @client.request( method: :post, path: "api/v1/credits/grants", body: parsed, model: Stigg::V1::Events::Credits::CreditGrantResponse, options: ) end |
#list(customer_id:, after: nil, before: nil, created_at: nil, currency_id: nil, limit: nil, resource_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::Events::Credits::GrantListResponse>
Some parameter documentations has been truncated, see Models::V1::Events::Credits::GrantListParams for more details.
Retrieves a paginated list of credit grants for a customer.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/stigg/resources/v1/events/credits/grants.rb', line 87 def list(params) parsed, = Stigg::V1::Events::Credits::GrantListParams.dump_request(params) query = Stigg::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "api/v1/credits/grants", query: query.transform_keys( customer_id: "customerId", created_at: "createdAt", currency_id: "currencyId", resource_id: "resourceId" ), page: Stigg::Internal::MyCursorIDPage, model: Stigg::Models::V1::Events::Credits::GrantListResponse, options: ) end |
#void(id, request_options: {}) ⇒ Stigg::Models::V1::Events::Credits::CreditGrantResponse
Voids an existing credit grant, preventing further consumption of the remaining credits.
117 118 119 120 121 122 123 124 |
# File 'lib/stigg/resources/v1/events/credits/grants.rb', line 117 def void(id, params = {}) @client.request( method: :post, path: ["api/v1/credits/grants/%1$s/void", id], model: Stigg::V1::Events::Credits::CreditGrantResponse, options: params[:request_options] ) end |