Class: Unit::Resource::AccountResource
- Inherits:
-
BaseResource
- Object
- BaseResource
- Unit::Resource::AccountResource
- Defined in:
- lib/unit/api_resources/account_resource.rb
Class Method Summary collapse
-
.activate_control_agreement(account_id) ⇒ UnitResponse, UnitError
Activate a control agreement by calling Unit’s API.
-
.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.
-
.deactivate_control_agreement(account_id) ⇒ UnitResponse, UnitError
Deactivate a control agreement by calling Unit’s API.
-
.enter_control_agreement(account_id) ⇒ UnitResponse, UnitError
Enter a control agreement 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
.activate_control_agreement(account_id) ⇒ UnitResponse, UnitError
Activate a control agreement by calling Unit’s API
24 25 26 27 |
# File 'lib/unit/api_resources/account_resource.rb', line 24 def activate_control_agreement(account_id) response = HttpHelper.post("#{api_url}/accounts/#{account_id}/activate-daca", headers: headers) response_handler(response) end |
.add_owners(request) ⇒ UnitResponse, UnitError
Add account owners by calling Unit’s API
132 133 134 135 136 |
# File 'lib/unit/api_resources/account_resource.rb', line 132 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
49 50 51 52 53 |
# File 'lib/unit/api_resources/account_resource.rb', line 49 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
40 41 42 43 44 |
# File 'lib/unit/api_resources/account_resource.rb', line 40 def create_account(request) payload = request.to_json_api response = HttpHelper.post("#{api_url}/accounts", body: payload, headers: headers) response_handler(response) end |
.deactivate_control_agreement(account_id) ⇒ UnitResponse, UnitError
Deactivate a control agreement by calling Unit’s API
32 33 34 35 |
# File 'lib/unit/api_resources/account_resource.rb', line 32 def deactivate_control_agreement(account_id) response = HttpHelper.post("#{api_url}/accounts/#{account_id}/deactivate-daca", headers: headers) response_handler(response) end |
.enter_control_agreement(account_id) ⇒ UnitResponse, UnitError
Enter a control agreement by calling Unit’s API
16 17 18 19 |
# File 'lib/unit/api_resources/account_resource.rb', line 16 def enter_control_agreement(account_id) response = HttpHelper.post("#{api_url}/accounts/#{account_id}/enter-daca", headers: headers) response_handler(response) end |
.freeze_account(request) ⇒ UnitResponse, UnitError
Freeze an account by calling Unit’s API
67 68 69 70 71 |
# File 'lib/unit/api_resources/account_resource.rb', line 67 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
84 85 86 87 |
# File 'lib/unit/api_resources/account_resource.rb', line 84 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
124 125 126 127 |
# File 'lib/unit/api_resources/account_resource.rb', line 124 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
116 117 118 119 |
# File 'lib/unit/api_resources/account_resource.rb', line 116 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
108 109 110 111 |
# File 'lib/unit/api_resources/account_resource.rb', line 108 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
92 93 94 95 |
# File 'lib/unit/api_resources/account_resource.rb', line 92 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
141 142 143 144 145 |
# File 'lib/unit/api_resources/account_resource.rb', line 141 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
59 60 61 62 |
# File 'lib/unit/api_resources/account_resource.rb', line 59 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
76 77 78 79 |
# File 'lib/unit/api_resources/account_resource.rb', line 76 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
99 100 101 102 103 |
# File 'lib/unit/api_resources/account_resource.rb', line 99 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 |