Class: Cards

Inherits:
Base show all
Defined in:
lib/bitnob/objects/virtual_cards.rb

Instance Attribute Summary

Attributes inherited from Base

#production, #secret_key, #url

Instance Method Summary collapse

Methods inherited from Base

#base_url, #check_parameters, #get_request, #initialize, #post_request, #put_request

Constructor Details

This class inherits a constructor from Base

Instance Method Details

#block(cardId) ⇒ Object

Block Card

  • Required Parameters CardID - uuid string



102
103
104
105
# File 'lib/bitnob/objects/virtual_cards.rb', line 102

def block(cardId)
    payload = { cardId: cardId}
    post_request("#{base_url}#{BaseEndpoints::CARDS}/block", payload.to_json)
end

#create(customerEmail) ⇒ Object

Create Card

  • Required Parameters customerEmail: string



42
43
44
45
# File 'lib/bitnob/objects/virtual_cards.rb', line 42

def create (customerEmail)
    body = { customerEmail: customerEmail}
    post_request("#{base_url}#{BaseEndpoints::CARDS}", body.to_json)
end

#freeze(cardId) ⇒ Object

Freeze Card

  • Required Parameters CardID - uuid string



68
69
70
71
# File 'lib/bitnob/objects/virtual_cards.rb', line 68

def freeze(cardId)
    payload = { cardId: cardId}
    post_request("#{base_url}#{BaseEndpoints::CARDS}/freeze", payload.to_json)
end

#mock_transaction(amount, cardId, type) ⇒ Object

Mock Transaction

  • Required Parameters amount: int CardID - uuid string Type - string



86
87
88
89
# File 'lib/bitnob/objects/virtual_cards.rb', line 86

def mock_transaction(amount, cardId, type)
    payload = { amount: amount, cardId: cardId, type: type}
    post_request("#{base_url}#{BaseEndpoints::CARDS}/mock-transaction", payload.to_json)
end

#register_user(data) ⇒ Object

idNumber : string ,

customerEmail: string,
idType: string,
phoneNumber: string,
firstName: string,
lastName: string,
userPhoto: string,
city: string,
state: string,
country: string,
zipCode: string,
line1: string,
amount: int
}


26
27
28
29
30
31
32
33
34
35
36
# File 'lib/bitnob/objects/virtual_cards.rb', line 26

def register_user(data)

    required_params = %w[customerEmail, idNumber, idNumber, firstName, lastName, city, state, country, zipCode, line1]

    checked_passed_parameters(required_params, data)

    payload = data.to_json

    post_request("#{base_url}#{BaseEndpoints::CARDS}/registercarduser", payload)

end

#terminate(cardId) ⇒ Object

Terminate card

  • Required Parameters CardID - uuid string



94
95
96
97
# File 'lib/bitnob/objects/virtual_cards.rb', line 94

def terminate(cardId)
    payload = {cardId: cardId}
    post_request("#{base_url}#{BaseEndpoints::CARDS}/terminate", payload.to_json)
end

#top_up(amount, cardId) ⇒ Object

Topup Card

  • Required Parameters amount: int CardID - uuid string



51
52
53
54
# File 'lib/bitnob/objects/virtual_cards.rb', line 51

def top_up(amount, cardId)
    payload = { amount: amount, cardId: cardId}
    post_request("#{base_url}#{BaseEndpoints::CARDS}/topup", payload.to_json)
end

#unblock(cardId) ⇒ Object

Block Card

  • Required Parameters CardID - uuid string



110
111
112
113
# File 'lib/bitnob/objects/virtual_cards.rb', line 110

def unblock(cardId)
    payload = { cardId: cardId}
    post_request("#{base_url}#{BaseEndpoints::CARDS}/unblock", payload.to_json)
end

#unfreeze(cardId) ⇒ Object

Unfreeze Card

  • Required Parameters CardID - uuid string



76
77
78
79
# File 'lib/bitnob/objects/virtual_cards.rb', line 76

def unfreeze(cardId)
    payload = { cardId: cardId}
    post_request("#{base_url}#{BaseEndpoints::CARDS}/unfreeze", payload.to_json)
end

#withdraw(amount, cardId) ⇒ Object

Withdraw From Card

  • Required Parameters amount: int CardID - uuid string



60
61
62
63
# File 'lib/bitnob/objects/virtual_cards.rb', line 60

def withdraw(amount, cardId)
    payload = { amount: amount, cardId: cardId}
    post_request("#{base_url}#{BaseEndpoints::CARDS}/withdraw", payload.to_json)
end