Class: MetronomeSDK::Resources::V1::CreditGrants
- Inherits:
-
Object
- Object
- MetronomeSDK::Resources::V1::CreditGrants
- Defined in:
- lib/metronome_sdk/resources/v1/credit_grants.rb
Instance Method Summary collapse
-
#create(customer_id: , expires_at: , grant_amount: , name: , paid_amount: , priority: , credit_grant_type: nil, custom_fields: nil, effective_at: nil, invoice_date: nil, product_ids: nil, reason: nil, rollover_settings: nil, uniqueness_key: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::CreditGrantCreateResponse
Some parameter documentations has been truncated, see Models::V1::CreditGrantCreateParams for more details.
-
#edit(id: , credit_grant_type: nil, expires_at: nil, name: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::CreditGrantEditResponse
Edit an existing credit grant.
-
#initialize(client:) ⇒ CreditGrants
constructor
private
A new instance of CreditGrants.
-
#list(limit: nil, next_page: nil, credit_grant_ids: nil, credit_type_ids: nil, customer_ids: nil, effective_before: nil, not_expiring_before: nil, request_options: {}) ⇒ MetronomeSDK::Internal::CursorPage<MetronomeSDK::Models::V1::CreditGrantListResponse>
Some parameter documentations has been truncated, see Models::V1::CreditGrantListParams for more details.
-
#list_entries(next_page: nil, sort: nil, credit_type_ids: nil, customer_ids: nil, ending_before: nil, starting_on: nil, request_options: {}) ⇒ MetronomeSDK::Internal::CursorPageWithoutLimit<MetronomeSDK::Models::V1::CreditGrantListEntriesResponse>
Some parameter documentations has been truncated, see Models::V1::CreditGrantListEntriesParams for more details.
-
#void(id: , release_uniqueness_key: nil, void_credit_purchase_invoice: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::CreditGrantVoidResponse
Void a credit grant.
Constructor Details
#initialize(client:) ⇒ CreditGrants
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 CreditGrants.
201 202 203 |
# File 'lib/metronome_sdk/resources/v1/credit_grants.rb', line 201 def initialize(client:) @client = client end |
Instance Method Details
#create(customer_id: , expires_at: , grant_amount: , name: , paid_amount: , priority: , credit_grant_type: nil, custom_fields: nil, effective_at: nil, invoice_date: nil, product_ids: nil, reason: nil, rollover_settings: nil, uniqueness_key: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::CreditGrantCreateResponse
Some parameter documentations has been truncated, see Models::V1::CreditGrantCreateParams for more details.
Create a new credit grant. This is a Plans (deprecated) endpoint. New clients should implement using Contracts.
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/metronome_sdk/resources/v1/credit_grants.rb', line 48 def create(params) parsed, = MetronomeSDK::V1::CreditGrantCreateParams.dump_request(params) @client.request( method: :post, path: "v1/credits/createGrant", body: parsed, model: MetronomeSDK::Models::V1::CreditGrantCreateResponse, options: ) end |
#edit(id: , credit_grant_type: nil, expires_at: nil, name: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::CreditGrantEditResponse
Edit an existing credit grant. This is a Plans (deprecated) endpoint. New clients should implement using Contracts.
118 119 120 121 122 123 124 125 126 127 |
# File 'lib/metronome_sdk/resources/v1/credit_grants.rb', line 118 def edit(params) parsed, = MetronomeSDK::V1::CreditGrantEditParams.dump_request(params) @client.request( method: :post, path: "v1/credits/editGrant", body: parsed, model: MetronomeSDK::Models::V1::CreditGrantEditResponse, options: ) end |
#list(limit: nil, next_page: nil, credit_grant_ids: nil, credit_type_ids: nil, customer_ids: nil, effective_before: nil, not_expiring_before: nil, request_options: {}) ⇒ MetronomeSDK::Internal::CursorPage<MetronomeSDK::Models::V1::CreditGrantListResponse>
Some parameter documentations has been truncated, see Models::V1::CreditGrantListParams for more details.
List credit grants. This list does not included voided grants. This is a Plans (deprecated) endpoint. New clients should implement using Contracts.
86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/metronome_sdk/resources/v1/credit_grants.rb', line 86 def list(params = {}) parsed, = MetronomeSDK::V1::CreditGrantListParams.dump_request(params) query_params = [:limit, :next_page] @client.request( method: :post, path: "v1/credits/listGrants", query: parsed.slice(*query_params), body: parsed.except(*query_params), page: MetronomeSDK::Internal::CursorPage, model: MetronomeSDK::Models::V1::CreditGrantListResponse, options: ) end |
#list_entries(next_page: nil, sort: nil, credit_type_ids: nil, customer_ids: nil, ending_before: nil, starting_on: nil, request_options: {}) ⇒ MetronomeSDK::Internal::CursorPageWithoutLimit<MetronomeSDK::Models::V1::CreditGrantListEntriesResponse>
Some parameter documentations has been truncated, see Models::V1::CreditGrantListEntriesParams for more details.
Fetches a list of credit ledger entries. Returns lists of ledgers per customer. Ledger entries are returned in chronological order. Ledger entries associated with voided credit grants are not included. This is a Plans (deprecated) endpoint. New clients should implement using Contracts.
effective_
157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/metronome_sdk/resources/v1/credit_grants.rb', line 157 def list_entries(params = {}) parsed, = MetronomeSDK::V1::CreditGrantListEntriesParams.dump_request(params) query_params = [:next_page, :sort] @client.request( method: :post, path: "v1/credits/listEntries", query: parsed.slice(*query_params), body: parsed.except(*query_params), page: MetronomeSDK::Internal::CursorPageWithoutLimit, model: MetronomeSDK::Models::V1::CreditGrantListEntriesResponse, options: ) end |
#void(id: , release_uniqueness_key: nil, void_credit_purchase_invoice: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::CreditGrantVoidResponse
Void a credit grant. This is a Plans (deprecated) endpoint. New clients should implement using Contracts.
187 188 189 190 191 192 193 194 195 196 |
# File 'lib/metronome_sdk/resources/v1/credit_grants.rb', line 187 def void(params) parsed, = MetronomeSDK::V1::CreditGrantVoidParams.dump_request(params) @client.request( method: :post, path: "v1/credits/voidGrant", body: parsed, model: MetronomeSDK::Models::V1::CreditGrantVoidResponse, options: ) end |