Class: SubAccountBase
- Defined in:
- lib/rave_ruby/rave_objects/base/sub_account_base.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#handle_create_response(response) ⇒ Object
method to handle subaccount creation response.
-
#handle_subaccount_response(response) ⇒ Object
method to list subaccounts response.
Methods inherited from Base
#check_passed_parameters, #get_request, #handle_list_bank, #initialize, #post_request
Constructor Details
This class inherits a constructor from Base
Instance Method Details
#handle_create_response(response) ⇒ Object
method to handle subaccount creation response
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rave_ruby/rave_objects/base/sub_account_base.rb', line 6 def handle_create_response(response) initiate_response = response status = initiate_response["status"] id = initiate_response["data"]["id"] if status == "success" response = {"error": false, "id": id, "data": initiate_response["data"]} return JSON.parse(response.to_json) else response = {"error": true, "data": initiate_response["data"]} raise InitiateTransferError, JSON.parse(response.to_json) end end |
#handle_subaccount_response(response) ⇒ Object
method to list subaccounts response
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rave_ruby/rave_objects/base/sub_account_base.rb', line 22 def handle_subaccount_response(response) subaccount_response = response if subaccount_response.code == 200 response = {"error" => false, "data" => JSON.parse(subaccount_response.body)} return response else response = {"error" => true, "data" => JSON.parse(subaccount_response.body)} raise InitiateTransferError, response end end |