Class: SubAccount
- Inherits:
-
SubAccountBase
- Object
- Base
- SubAccountBase
- SubAccount
- Defined in:
- lib/rave_ruby/rave_objects/sub_account.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#create_subaccount(data) ⇒ Object
method to create subaccount.
-
#delete_subaccount(subaccount_id) ⇒ Object
method to delete a subaccount.
-
#fetch_subaccount(subaccount_id) ⇒ Object
method to fetch a subaccount.
-
#list_subaccounts ⇒ Object
method to list all subaccounts.
Methods inherited from SubAccountBase
#handle_create_response, #handle_subaccount_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
#create_subaccount(data) ⇒ Object
method to create subaccount
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rave_ruby/rave_objects/sub_account.rb', line 7 def create_subaccount(data) base_url = rave_object.base_url data.merge!({"seckey" => rave_object.secret_key.dup}) required_parameters = ["account_bank", "account_number", "business_name", "business_email", "business_contact", "business_contact_mobile", "business_mobile", "split_type", "split_value"] check_passed_parameters(required_parameters, data) payload = data.to_json response = post_request("#{base_url}#{BASE_ENDPOINTS::SUBACCOUNT_ENDPOINT}/create", payload) return handle_create_response(response) end |
#delete_subaccount(subaccount_id) ⇒ Object
method to delete a subaccount
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rave_ruby/rave_objects/sub_account.rb', line 42 def delete_subaccount(subaccount_id) base_url = rave_object.base_url payload = { "seckey" => rave_object.secret_key.dup, "id" => subaccount_id } payload = payload.to_json response = post_request("#{base_url}#{BASE_ENDPOINTS::SUBACCOUNT_ENDPOINT}/delete", payload) return handle_subaccount_response(response) end |
#fetch_subaccount(subaccount_id) ⇒ Object
method to fetch a subaccount
32 33 34 35 36 37 38 |
# File 'lib/rave_ruby/rave_objects/sub_account.rb', line 32 def fetch_subaccount(subaccount_id) base_url = rave_object.base_url response = get_request("#{base_url}#{BASE_ENDPOINTS::SUBACCOUNT_ENDPOINT}/get/#{subaccount_id}", {"seckey" => rave_object.secret_key.dup}) return handle_subaccount_response(response) end |
#list_subaccounts ⇒ Object
method to list all subaccounts
23 24 25 26 27 28 29 |
# File 'lib/rave_ruby/rave_objects/sub_account.rb', line 23 def list_subaccounts base_url = rave_object.base_url response = get_request("#{base_url}#{BASE_ENDPOINTS::SUBACCOUNT_ENDPOINT}", {"seckey" => rave_object.secret_key.dup}) return handle_subaccount_response(response) end |