Class: Beneficiaries

Inherits:
Base
  • Object
show all
Defined in:
lib/flutterwave_sdk/flutterwave_objects/beneficiaries.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_beneficiary(data) ⇒ Object



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

def create_beneficiary(data)
    base_url = flutterwave_object.base_url 
    required_parameters = ["account_number", "account_bank"]
    check_passed_parameters(required_parameters, data)
    payload = data.to_json
    response = post_request("#{base_url}/beneficiaries", payload) 
    return response
end

#delete_beneficiary(id) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/flutterwave_sdk/flutterwave_objects/beneficiaries.rb', line 27

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

#fetch_beneficiary(id) ⇒ Object



21
22
23
24
25
# File 'lib/flutterwave_sdk/flutterwave_objects/beneficiaries.rb', line 21

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

#list_beneficiariesObject



15
16
17
18
19
# File 'lib/flutterwave_sdk/flutterwave_objects/beneficiaries.rb', line 15

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