Class: Increase::Resources::PendingTransactions
- Inherits:
-
Object
- Object
- Increase::Resources::PendingTransactions
- Defined in:
- lib/increase/resources/pending_transactions.rb,
sig/increase/resources/pending_transactions.rbs
Instance Method Summary collapse
-
#create(account_id:, amount:, description: nil, request_options: {}) ⇒ Increase::Models::PendingTransaction
Creates a pending transaction on an account.
-
#initialize(client:) ⇒ PendingTransactions
constructor
private
A new instance of PendingTransactions.
-
#list(account_id: nil, category: nil, created_at: nil, cursor: nil, limit: nil, route_id: nil, status: nil, request_options: {}) ⇒ Increase::Internal::Page<Increase::Models::PendingTransaction>
List Pending Transactions.
-
#release(pending_transaction_id, request_options: {}) ⇒ Increase::Models::PendingTransaction
Release a Pending Transaction you had previously created.
-
#retrieve(pending_transaction_id, request_options: {}) ⇒ Increase::Models::PendingTransaction
Retrieve a Pending Transaction.
Constructor Details
#initialize(client:) ⇒ PendingTransactions
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 PendingTransactions.
125 126 127 |
# File 'lib/increase/resources/pending_transactions.rb', line 125 def initialize(client:) @client = client end |
Instance Method Details
#create(account_id:, amount:, description: nil, request_options: {}) ⇒ Increase::Models::PendingTransaction
Creates a pending transaction on an account. This can be useful to hold funds
for an external payment or known future transaction outside of Increase (only
negative amounts are supported). The resulting Pending Transaction will have a
category of user_initiated_hold and can be released via the API to unlock
the held funds.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/increase/resources/pending_transactions.rb', line 28 def create(params) parsed, = Increase::PendingTransactionCreateParams.dump_request(params) @client.request( method: :post, path: "pending_transactions", body: parsed, model: Increase::PendingTransaction, options: ) end |
#list(account_id: nil, category: nil, created_at: nil, cursor: nil, limit: nil, route_id: nil, status: nil, request_options: {}) ⇒ Increase::Internal::Page<Increase::Models::PendingTransaction>
List Pending Transactions
86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/increase/resources/pending_transactions.rb', line 86 def list(params = {}) parsed, = Increase::PendingTransactionListParams.dump_request(params) query = Increase::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "pending_transactions", query: query, page: Increase::Internal::Page, model: Increase::PendingTransaction, options: ) end |
#release(pending_transaction_id, request_options: {}) ⇒ Increase::Models::PendingTransaction
Release a Pending Transaction you had previously created. The Pending
Transaction must have a category of user_initiated_hold and a status of
pending. This will unlock the held funds and mark the Pending Transaction as
complete.
113 114 115 116 117 118 119 120 |
# File 'lib/increase/resources/pending_transactions.rb', line 113 def release(pending_transaction_id, params = {}) @client.request( method: :post, path: ["pending_transactions/%1$s/release", pending_transaction_id], model: Increase::PendingTransaction, options: params[:request_options] ) end |
#retrieve(pending_transaction_id, request_options: {}) ⇒ Increase::Models::PendingTransaction
Retrieve a Pending Transaction
50 51 52 53 54 55 56 57 |
# File 'lib/increase/resources/pending_transactions.rb', line 50 def retrieve(pending_transaction_id, params = {}) @client.request( method: :get, path: ["pending_transactions/%1$s", pending_transaction_id], model: Increase::PendingTransaction, options: params[:request_options] ) end |