Class: Subaccount

Inherits:
Base
  • Object
show all
Defined in:
lib/flutterwave_sdk/flutterwave_objects/subaccount.rb

Instance Attribute Summary

Attributes inherited from Base

#flutterwave_object

Instance Method Summary collapse

Methods inherited from Base

#check_passed_parameters, #delete_request, #get_request, #initialize, #post_request, #put_request

Constructor Details

This class inherits a constructor from Base

Instance Method Details

#create_subaccount(data) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/flutterwave_sdk/flutterwave_objects/subaccount.rb', line 5

def create_subaccount(data)
    base_url = flutterwave_object.base_url 
    required_parameters = ["account_bank", "account_number", "business_name", "business_contact", "country", "split_value", "business_mobile"]
    check_passed_parameters(required_parameters, data)
    payload = data.to_json
    response = post_request("#{base_url}/subaccounts", payload) 
    return response
end

#delete_subaccount(id) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/flutterwave_sdk/flutterwave_objects/subaccount.rb', line 33

def delete_subaccount(id)
    base_url = flutterwave_object.base_url 
    payload = {}
    payload = payload.to_json
    response = delete_request("#{base_url}/subaccounts/#{id}", payload) 
    return response
end

#fetch_subaccount(id) ⇒ Object



20
21
22
23
24
# File 'lib/flutterwave_sdk/flutterwave_objects/subaccount.rb', line 20

def fetch_subaccount(id)
    base_url = flutterwave_object.base_url 
    response = get_request("#{base_url}/subaccounts/#{id}") 
    return response
end

#fetch_subaccountsObject



14
15
16
17
18
# File 'lib/flutterwave_sdk/flutterwave_objects/subaccount.rb', line 14

def fetch_subaccounts
    base_url = flutterwave_object.base_url 
    response = get_request("#{base_url}/subaccounts") 
    return response
end

#update_subaccount(id, data) ⇒ Object



26
27
28
29
30
31
# File 'lib/flutterwave_sdk/flutterwave_objects/subaccount.rb', line 26

def update_subaccount(id, data)
    base_url = flutterwave_object.base_url 
    payload = data.to_json
    response = put_request("#{base_url}/subaccounts/#{id}", payload)
    return response
end