Class: Orb::Resources::CreditBlocks
- Inherits:
-
Object
- Object
- Orb::Resources::CreditBlocks
- Defined in:
- lib/orb/resources/credit_blocks.rb,
sig/orb/resources/credit_blocks.rbs
Overview
The Credit Ledger Entry resource models prepaid credits within Orb.
Instance Method Summary collapse
-
#delete(block_id, request_options: {}) ⇒ nil
This endpoint deletes a credit block by its ID.
-
#initialize(client:) ⇒ CreditBlocks
constructor
private
A new instance of CreditBlocks.
-
#list_invoices(block_id, request_options: {}) ⇒ Orb::Models::CreditBlockListInvoicesResponse
This endpoint returns the credit block and its associated purchasing invoices.
-
#retrieve(block_id, request_options: {}) ⇒ Orb::Models::CreditBlockRetrieveResponse
This endpoint returns a credit block identified by its block_id.
Constructor Details
#initialize(client:) ⇒ CreditBlocks
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 CreditBlocks.
98 99 100 |
# File 'lib/orb/resources/credit_blocks.rb', line 98 def initialize(client:) @client = client end |
Instance Method Details
#delete(block_id, request_options: {}) ⇒ nil
This endpoint deletes a credit block by its ID.
When a credit block is deleted:
- The block is removed from the customer's credit ledger.
- Any usage of the credit block is reversed, and the ledger is replayed as if the block never existed.
- If invoices were generated from the purchase of the credit block, they will be deleted if in draft status, voided if issued, or a credit note will be issued if the invoice is paid.
51 52 53 54 55 56 57 58 |
# File 'lib/orb/resources/credit_blocks.rb', line 51 def delete(block_id, params = {}) @client.request( method: :delete, path: ["credit_blocks/%1$s", block_id], model: NilClass, options: params[:request_options] ) end |
#list_invoices(block_id, request_options: {}) ⇒ Orb::Models::CreditBlockListInvoicesResponse
This endpoint returns the credit block and its associated purchasing invoices.
If a credit block was purchased (as opposed to being manually added), this endpoint returns the invoices that were created to charge the customer for the credit block. For credit blocks with payment schedules spanning multiple periods (e.g., monthly payments over 12 months), multiple invoices will be returned.
For credit blocks created by subscription allocation prices, this endpoint returns the subscription invoice containing the allocation line item that created the block.
If the credit block was not purchased (e.g., manual increment), an empty invoices list is returned.
Note: This endpoint is currently experimental and its interface may change in future releases. Please contact support before building production integrations against this endpoint.
86 87 88 89 90 91 92 93 |
# File 'lib/orb/resources/credit_blocks.rb', line 86 def list_invoices(block_id, params = {}) @client.request( method: :get, path: ["credit_blocks/%1$s/invoices", block_id], model: Orb::Models::CreditBlockListInvoicesResponse, options: params[:request_options] ) end |
#retrieve(block_id, request_options: {}) ⇒ Orb::Models::CreditBlockRetrieveResponse
This endpoint returns a credit block identified by its block_id.
18 19 20 21 22 23 24 25 |
# File 'lib/orb/resources/credit_blocks.rb', line 18 def retrieve(block_id, params = {}) @client.request( method: :get, path: ["credit_blocks/%1$s", block_id], model: Orb::Models::CreditBlockRetrieveResponse, options: params[:request_options] ) end |