Class: ModernTreasury::LedgerEntryApi
- Defined in:
- lib/modern_treasury/apis/ledger_entry_api.rb
Overview
LedgerEntryApi
Constant Summary
Constants inherited from BaseApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#get_ledger_entry(id, show_balances: nil) ⇒ ApiResponse
Get details on a single ledger entry.
-
#list_ledger_entries(after_cursor: nil, per_page: nil, id: nil, ledger_account_id: nil, ledger_transaction_id: nil, ledger_account_payout_id: nil, effective_date: nil, effective_at: nil, updated_at: nil, as_of_lock_version: nil, ledger_account_lock_version: nil, ledger_account_category_id: nil, ledger_account_statement_id: nil, show_deleted: nil, direction: nil, status: nil, order_by: nil, show_balances: nil, metadata: nil) ⇒ ApiResponse
Get a list of all ledger entries.
Methods inherited from BaseApi
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from ModernTreasury::BaseApi
Instance Method Details
#get_ledger_entry(id, show_balances: nil) ⇒ ApiResponse
Get details on a single ledger entry. response will include the balances attached to the ledger entry. If there is no balance available, null will be returned instead.
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/modern_treasury/apis/ledger_entry_api.rb', line 128 def get_ledger_entry(id, show_balances: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/ledger_entries/{id}', Server::DEFAULT) .template_param(new_parameter(id, key: 'id') .is_required(true) .should_encode(true)) .query_param(new_parameter(show_balances, key: 'show_balances')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(LedgerEntry.method(:from_hash)) .is_api_response(true) .local_error('404', 'not found', ErrorMessageException)) .execute end |
#list_ledger_entries(after_cursor: nil, per_page: nil, id: nil, ledger_account_id: nil, ledger_transaction_id: nil, ledger_account_payout_id: nil, effective_date: nil, effective_at: nil, updated_at: nil, as_of_lock_version: nil, ledger_account_lock_version: nil, ledger_account_category_id: nil, ledger_account_statement_id: nil, show_deleted: nil, direction: nil, status: nil, order_by: nil, show_balances: nil, metadata: nil) ⇒ ApiResponse
Get a list of all ledger entries. here here description here description here description here description here (>), ‘gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the transaction’s effective date. Format YYYY-MM-DD (>), ‘gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the transaction’s effective time. Format ISO8601 (>), ‘gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the posted at timestamp. For example, for all times after Jan 1 2000 12:00 UTC, use updated_at%5Bgt%5D=2000-01-01T12:00:00Z. entries that were present on a ledger account at a particular `lock_version`. You must also specify `ledger_account_id`. parameter: Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the lock_version of a ledger account. For example, for all entries created at or before before lock_version 1000 of a ledger account, use `ledger_account_lock_version%5Blte%5D=1000`. ledger entries that match the direction specified. One of `credit`, `debit`. ledger entries that are included in the ledger account statement. response will include ledger entries that were deleted. When you update a ledger transaction to specify a new set of entries, the previous entries are deleted. include ledger entries that were deleted. When you update a ledger transaction to specify a new set of entries, the previous entries are deleted. match the status specified. One of `pending`, `posted`, or `archived`. `effective_at` in `asc` or `desc` order. For example, to order by `effective_at asc`, use `order_by%5Beffective_at%5D=asc`. Ordering by only one field at a time is supported. response will include the balances attached to the ledger entry. If there is no balance available, null will be returned instead. you want to query for records with metadata key `Type` and value `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query parameters.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/modern_treasury/apis/ledger_entry_api.rb', line 67 def list_ledger_entries(after_cursor: nil, per_page: nil, id: nil, ledger_account_id: nil, ledger_transaction_id: nil, ledger_account_payout_id: nil, effective_date: nil, effective_at: nil, updated_at: nil, as_of_lock_version: nil, ledger_account_lock_version: nil, ledger_account_category_id: nil, ledger_account_statement_id: nil, show_deleted: nil, direction: nil, status: nil, order_by: nil, show_balances: nil, metadata: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/ledger_entries', Server::DEFAULT) .query_param(new_parameter(after_cursor, key: 'after_cursor')) .query_param(new_parameter(per_page, key: 'per_page')) .query_param(new_parameter(id, key: 'id')) .query_param(new_parameter(ledger_account_id, key: 'ledger_account_id')) .query_param(new_parameter(ledger_transaction_id, key: 'ledger_transaction_id')) .query_param(new_parameter(ledger_account_payout_id, key: 'ledger_account_payout_id')) .query_param(new_parameter(effective_date, key: 'effective_date')) .query_param(new_parameter(effective_at, key: 'effective_at')) .query_param(new_parameter(updated_at, key: 'updated_at')) .query_param(new_parameter(as_of_lock_version, key: 'as_of_lock_version')) .query_param(new_parameter(ledger_account_lock_version, key: 'ledger_account_lock_version')) .query_param(new_parameter(ledger_account_category_id, key: 'ledger_account_category_id')) .query_param(new_parameter(ledger_account_statement_id, key: 'ledger_account_statement_id')) .query_param(new_parameter(show_deleted, key: 'show_deleted')) .query_param(new_parameter(direction, key: 'direction')) .query_param(new_parameter(status, key: 'status')) .query_param(new_parameter(order_by, key: 'order_by')) .query_param(new_parameter(show_balances, key: 'show_balances')) .query_param(new_parameter(, key: 'metadata')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(LedgerEntry.method(:from_hash)) .is_api_response(true) .is_response_array(true) .local_error('422', 'unsuccessful', ErrorMessageException)) .execute end |