Class: Lithic::Resources::Holds
- Inherits:
-
Object
- Object
- Lithic::Resources::Holds
- Defined in:
- lib/lithic/resources/holds.rb
Instance Method Summary collapse
-
#create(financial_account_token, amount:, token: nil, expiration_datetime: nil, memo: nil, user_defined_id: nil, request_options: {}) ⇒ Lithic::Models::Hold
Create a hold on a financial account.
-
#initialize(client:) ⇒ Holds
constructor
private
A new instance of Holds.
-
#list(financial_account_token, begin_: nil, end_: nil, ending_before: nil, page_size: nil, starting_after: nil, status: nil, request_options: {}) ⇒ Lithic::Internal::CursorPage<Lithic::Models::Hold>
Some parameter documentations has been truncated, see Models::HoldListParams for more details.
-
#retrieve(hold_token, request_options: {}) ⇒ Lithic::Models::Hold
Get hold by token.
-
#void(hold_token, memo: nil, request_options: {}) ⇒ Lithic::Models::Hold
Void an active hold.
Constructor Details
#initialize(client:) ⇒ Holds
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 Holds.
127 128 129 |
# File 'lib/lithic/resources/holds.rb', line 127 def initialize(client:) @client = client end |
Instance Method Details
#create(financial_account_token, amount:, token: nil, expiration_datetime: nil, memo: nil, user_defined_id: nil, request_options: {}) ⇒ Lithic::Models::Hold
Create a hold on a financial account. Holds reserve funds by moving them from available to pending balance. They can be resolved via settlement (linked to a payment or book transfer), voiding, or expiration.
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/lithic/resources/holds.rb', line 29 def create(financial_account_token, params) parsed, = Lithic::HoldCreateParams.dump_request(params) @client.request( method: :post, path: ["v1/financial_accounts/%1$s/holds", financial_account_token], body: parsed, model: Lithic::Hold, options: ) end |
#list(financial_account_token, begin_: nil, end_: nil, ending_before: nil, page_size: nil, starting_after: nil, status: nil, request_options: {}) ⇒ Lithic::Internal::CursorPage<Lithic::Models::Hold>
Some parameter documentations has been truncated, see Models::HoldListParams for more details.
List holds for a financial account.
86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/lithic/resources/holds.rb', line 86 def list(financial_account_token, params = {}) parsed, = Lithic::HoldListParams.dump_request(params) query = Lithic::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["v1/financial_accounts/%1$s/holds", financial_account_token], query: query.transform_keys(begin_: "begin", end_: "end"), page: Lithic::Internal::CursorPage, model: Lithic::Hold, options: ) end |
#retrieve(hold_token, request_options: {}) ⇒ Lithic::Models::Hold
Get hold by token.
51 52 53 54 55 56 57 58 |
# File 'lib/lithic/resources/holds.rb', line 51 def retrieve(hold_token, params = {}) @client.request( method: :get, path: ["v1/holds/%1$s", hold_token], model: Lithic::Hold, options: params[:request_options] ) end |
#void(hold_token, memo: nil, request_options: {}) ⇒ Lithic::Models::Hold
Void an active hold. This returns the held funds from pending back to available balance. Only holds in PENDING status can be voided.
113 114 115 116 117 118 119 120 121 122 |
# File 'lib/lithic/resources/holds.rb', line 113 def void(hold_token, params = {}) parsed, = Lithic::HoldVoidParams.dump_request(params) @client.request( method: :post, path: ["v1/holds/%1$s/void", hold_token], body: parsed, model: Lithic::Hold, options: ) end |