Class: VirtualCard

Inherits:
Base
  • Object
show all
Defined in:
lib/flutterwave_sdk/flutterwave_objects/virtual_card.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

#block_unblock_virtual_card(id, status_action) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/flutterwave_sdk/flutterwave_objects/virtual_card.rb', line 59

def block_unblock_virtual_card(id, status_action)
    base_url = flutterwave_object.base_url 
    payload = {}
    payload = payload.to_json
    response = put_request("#{base_url}/virtual-cards/#{id}/status/#{status_action}", payload) 
    return response
end

#create_virtual_card(data) ⇒ Object



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

def create_virtual_card(data)
    base_url = flutterwave_object.base_url 
    required_parameters = ["currency", "amount", "billing_name"]
    check_passed_parameters(required_parameters, data)
    payload = data.to_json
    response = post_request("#{base_url}/virtual-cards", payload) 
    return response
end

#fund_virtual_card(id, data) ⇒ Object



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

def fund_virtual_card(id, data)
    base_url = flutterwave_object.base_url 
    required_parameters = [ "amount"]
    check_passed_parameters(required_parameters, data)
    payload = data.to_json
    response = post_request("#{base_url}/virtual-cards/#{id}/fund", payload) 
    return response
end

#get_all_virtual_cardsObject



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

def get_all_virtual_cards
    base_url = flutterwave_object.base_url 
    response = get_request("#{base_url}/virtual-cards")
    return response
end

#get_virtual_card(id) ⇒ Object



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

def get_virtual_card(id)
    base_url = flutterwave_object.base_url 
    response = get_request("#{base_url}/virtual-cards/#{id}")
    return response
end

#get_virtual_card_transactions(id, from, to, index, size) ⇒ Object



44
45
46
47
48
# File 'lib/flutterwave_sdk/flutterwave_objects/virtual_card.rb', line 44

def get_virtual_card_transactions(id, from, to, index, size)
    base_url = flutterwave_object.base_url 
    response = get_request("#{base_url}/virtual-cards/#{id}/transactions", {"from" => from, "to" => to, "index" => index, "size" => size})
    return response
end

#terminate_virtual_card(id) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/flutterwave_sdk/flutterwave_objects/virtual_card.rb', line 36

def terminate_virtual_card(id)
    base_url = flutterwave_object.base_url 
    payload = {}
    payload = payload.to_json
    response = put_request("#{base_url}/virtual-cards/#{id}/terminate", payload) 
    return response
end

#withdraw_from_virtual_card(id, data) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/flutterwave_sdk/flutterwave_objects/virtual_card.rb', line 50

def withdraw_from_virtual_card(id, data)
    base_url = flutterwave_object.base_url 
    required_parameters = [ "amount"]
    check_passed_parameters(required_parameters, data)
    payload = data.to_json
    response = post_request("#{base_url}/virtual-cards/#{id}/withdraw", payload) 
    return response
end