Class: Increase::Resources::Accounts
- Inherits:
-
Object
- Object
- Increase::Resources::Accounts
- Defined in:
- lib/increase/resources/accounts.rb,
sig/increase/resources/accounts.rbs
Instance Method Summary collapse
-
#balance(account_id, at_time: nil, request_options: {}) ⇒ Increase::Models::BalanceLookup
Retrieve the current and available balances for an account in minor units of the account's currency.
-
#close(account_id, request_options: {}) ⇒ Increase::Models::Account
Close an Account.
-
#create(name:, entity_id: nil, funding: nil, informational_entity_id: nil, loan: nil, program_id: nil, request_options: {}) ⇒ Increase::Models::Account
Create an Account.
-
#initialize(client:) ⇒ Accounts
constructor
private
A new instance of Accounts.
-
#list(created_at: nil, cursor: nil, entity_id: nil, idempotency_key: nil, informational_entity_id: nil, limit: nil, program_id: nil, status: nil, request_options: {}) ⇒ Increase::Internal::Page<Increase::Models::Account>
List Accounts.
-
#retrieve(account_id, request_options: {}) ⇒ Increase::Models::Account
Retrieve an Account.
-
#update(account_id, loan: nil, name: nil, request_options: {}) ⇒ Increase::Models::Account
Update an Account.
Constructor Details
#initialize(client:) ⇒ Accounts
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 Accounts.
186 187 188 |
# File 'lib/increase/resources/accounts.rb', line 186 def initialize(client:) @client = client end |
Instance Method Details
#balance(account_id, at_time: nil, request_options: {}) ⇒ Increase::Models::BalanceLookup
Retrieve the current and available balances for an account in minor units of the account's currency. Learn more about account balances.
151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/increase/resources/accounts.rb', line 151 def balance(account_id, params = {}) parsed, = Increase::AccountBalanceParams.dump_request(params) query = Increase::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["accounts/%1$s/balance", account_id], query: query, model: Increase::BalanceLookup, options: ) end |
#close(account_id, request_options: {}) ⇒ Increase::Models::Account
Close an Account
174 175 176 177 178 179 180 181 |
# File 'lib/increase/resources/accounts.rb', line 174 def close(account_id, params = {}) @client.request( method: :post, path: ["accounts/%1$s/close", account_id], model: Increase::Account, options: params[:request_options] ) end |
#create(name:, entity_id: nil, funding: nil, informational_entity_id: nil, loan: nil, program_id: nil, request_options: {}) ⇒ Increase::Models::Account
Create an Account
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/increase/resources/accounts.rb', line 33 def create(params) parsed, = Increase::AccountCreateParams.dump_request(params) @client.request( method: :post, path: "accounts", body: parsed, model: Increase::Account, options: ) end |
#list(created_at: nil, cursor: nil, entity_id: nil, idempotency_key: nil, informational_entity_id: nil, limit: nil, program_id: nil, status: nil, request_options: {}) ⇒ Increase::Internal::Page<Increase::Models::Account>
List Accounts
124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/increase/resources/accounts.rb', line 124 def list(params = {}) parsed, = Increase::AccountListParams.dump_request(params) query = Increase::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "accounts", query: query, page: Increase::Internal::Page, model: Increase::Account, options: ) end |
#retrieve(account_id, request_options: {}) ⇒ Increase::Models::Account
Retrieve an Account
55 56 57 58 59 60 61 62 |
# File 'lib/increase/resources/accounts.rb', line 55 def retrieve(account_id, params = {}) @client.request( method: :get, path: ["accounts/%1$s", account_id], model: Increase::Account, options: params[:request_options] ) end |
#update(account_id, loan: nil, name: nil, request_options: {}) ⇒ Increase::Models::Account
Update an Account
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/increase/resources/accounts.rb', line 79 def update(account_id, params = {}) parsed, = Increase::AccountUpdateParams.dump_request(params) @client.request( method: :patch, path: ["accounts/%1$s", account_id], body: parsed, model: Increase::Account, options: ) end |