Class: Unit::Resource::AccountResource
- Inherits:
-
BaseResource
- Object
- BaseResource
- Unit::Resource::AccountResource
- Defined in:
- lib/unit/api_resources/account_resource.rb
Class Method Summary collapse
-
.add_owners(request) ⇒ UnitResponse, UnitError
Add account owners by calling Unit’s API.
-
.close_account(request) ⇒ UnitResponse, UnitError
Close an account by calling Unit’s API.
-
.create_account(request) ⇒ UnitResponse, UnitError
Create a new account by calling Unit’s API.
-
.freeze_account(request) ⇒ UnitResponse, UnitError
Freeze an account by calling Unit’s API.
-
.get_account(account_id) ⇒ UnitResponse, UnitError
Get account by calling Unit’s API.
-
.get_account_balance_history(params) ⇒ UnitResponse, UnitError
Get account balance history by calling Unit’s API.
-
.get_deposit_products(account_id) ⇒ UnitResponse, UnitError
Get deposit products by calling Unit’s API.
-
.limits(account_id) ⇒ UnitResponse, UnitError
Limit account by calling Unit’s API.
-
.list_accounts(params = nil) ⇒ UnitResponse, UnitError
List accounts by calling Unit’s API.
-
.remove_owners(request) ⇒ UnitResponse, UnitError
Remove account owners by calling Unit’s API.
-
.reopen_account(account_id) ⇒ UnitResponse, UnitError
Reopen an account by calling Unit’s API.
-
.unfreeze_account(account_id) ⇒ UnitResponse, UnitError
Unfreeze an account by calling Unit’s API.
-
.update_account(request) ⇒ Object
Update account by calling Unit’s API.
Methods inherited from BaseResource
file_response_handler, response_handler
Class Method Details
.add_owners(request) ⇒ UnitResponse, UnitError
Add account owners by calling Unit’s API
108 109 110 111 112 |
# File 'lib/unit/api_resources/account_resource.rb', line 108 def add_owners(request) payload = request.to_json_api response = HttpHelper.post("#{api_url}/accounts/#{request.account_id}/relationships/customers", body: payload, headers: headers) response_handler(response) end |
.close_account(request) ⇒ UnitResponse, UnitError
Close an account by calling Unit’s API
25 26 27 28 29 |
# File 'lib/unit/api_resources/account_resource.rb', line 25 def close_account(request) payload = request.to_json_api response = HttpHelper.post("#{api_url}/accounts/#{request.account_id}/close", body: payload, headers: headers) response_handler(response) end |
.create_account(request) ⇒ UnitResponse, UnitError
Create a new account by calling Unit’s API
16 17 18 19 20 |
# File 'lib/unit/api_resources/account_resource.rb', line 16 def create_account(request) payload = request.to_json_api response = HttpHelper.post("#{api_url}/accounts", body: payload, headers: headers) response_handler(response) end |
.freeze_account(request) ⇒ UnitResponse, UnitError
Freeze an account by calling Unit’s API
43 44 45 46 47 |
# File 'lib/unit/api_resources/account_resource.rb', line 43 def freeze_account(request) payload = request.to_json_api response = HttpHelper.post("#{api_url}/accounts/#{request.account_id}/freeze", body: payload, headers: headers) response_handler(response) end |
.get_account(account_id) ⇒ UnitResponse, UnitError
Get account by calling Unit’s API
60 61 62 63 |
# File 'lib/unit/api_resources/account_resource.rb', line 60 def get_account(account_id) response = HttpHelper.get("#{api_url}/accounts/#{account_id}", headers: headers) response_handler(response) end |
.get_account_balance_history(params) ⇒ UnitResponse, UnitError
Get account balance history by calling Unit’s API
100 101 102 103 |
# File 'lib/unit/api_resources/account_resource.rb', line 100 def get_account_balance_history(params) response = HttpHelper.get("#{api_url}/account-end-of-day", params: params.to_hash, headers: headers) response_handler(response) end |
.get_deposit_products(account_id) ⇒ UnitResponse, UnitError
Get deposit products by calling Unit’s API
92 93 94 95 |
# File 'lib/unit/api_resources/account_resource.rb', line 92 def get_deposit_products(account_id) response = HttpHelper.get("#{api_url}/accounts/#{account_id}/deposit-products", headers: headers) response_handler(response) end |
.limits(account_id) ⇒ UnitResponse, UnitError
Limit account by calling Unit’s API
84 85 86 87 |
# File 'lib/unit/api_resources/account_resource.rb', line 84 def limits(account_id) response = HttpHelper.get("#{api_url}/accounts/#{account_id}/limits", headers: headers) response_handler(response) end |
.list_accounts(params = nil) ⇒ UnitResponse, UnitError
List accounts by calling Unit’s API
68 69 70 71 |
# File 'lib/unit/api_resources/account_resource.rb', line 68 def list_accounts(params = nil) response = HttpHelper.get("#{api_url}/accounts", params: params.to_hash, headers: headers) response_handler(response) end |
.remove_owners(request) ⇒ UnitResponse, UnitError
Remove account owners by calling Unit’s API
117 118 119 120 121 |
# File 'lib/unit/api_resources/account_resource.rb', line 117 def remove_owners(request) payload = request.to_json_api response = HttpHelper.delete("#{api_url}/accounts/#{request.account_id}/relationships/customers", body: payload, headers: headers) response_handler(response) end |
.reopen_account(account_id) ⇒ UnitResponse, UnitError
Reopen an account by calling Unit’s API
35 36 37 38 |
# File 'lib/unit/api_resources/account_resource.rb', line 35 def reopen_account(account_id) response = HttpHelper.post("#{api_url}/accounts/#{account_id}/reopen", headers: headers) response_handler(response) end |
.unfreeze_account(account_id) ⇒ UnitResponse, UnitError
Unfreeze an account by calling Unit’s API
52 53 54 55 |
# File 'lib/unit/api_resources/account_resource.rb', line 52 def unfreeze_account(account_id) response = HttpHelper.post("#{api_url}/accounts/#{account_id}/unfreeze", headers: headers) response_handler(response) end |
.update_account(request) ⇒ Object
Update account by calling Unit’s API
75 76 77 78 79 |
# File 'lib/unit/api_resources/account_resource.rb', line 75 def update_account(request) payload = request.to_json_api response = HttpHelper.patch("#{api_url}/accounts/#{request.account_id}", body: payload, headers: headers) response_handler(response) end |