svbclient 3.2.3 → 3.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/svbclient.rb +49 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df1dfa58bb26e3392d829fe51cbdf7e5e4b4415e
|
4
|
+
data.tar.gz: 69dea9e6a0ab2a478db72ab052d0e2ac2c7f871e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fffa50c2541e00426874566e3768769f9941171caf355f6c5e5fdc98dc39ed6ab66c613540796f7f90e1ce3fd7a6dc35dfd664cb7f693bf80be8d32c72919417
|
7
|
+
data.tar.gz: 4886253ac6591fc357af6f60c07b7edb2f5fa85a1c57669ee8a8e8c16d6986ae5abd0124e271445f8da6664f750d5a6f4e533d5bc2bb7ca9fc494c9fdfdf5ed3
|
data/lib/svbclient.rb
CHANGED
@@ -101,6 +101,55 @@ class SVBClient::Account
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
+
class SVBClient::VirtualCard
|
105
|
+
def initialize(client, id)
|
106
|
+
@client = client
|
107
|
+
@id = id
|
108
|
+
end
|
109
|
+
|
110
|
+
def update(card_data)
|
111
|
+
JSON.parse(@client.patch("/v1/virtualcards/#{@id}", card_data).body)["data"]
|
112
|
+
end
|
113
|
+
|
114
|
+
def data(show_card_number: false)
|
115
|
+
query = show_card_number ? 'show_card_number=true' : ''
|
116
|
+
JSON.parse(@client.get("/v1/virtualcards/#{@id}", query).body)["data"]
|
117
|
+
end
|
118
|
+
|
119
|
+
def email_to(address)
|
120
|
+
JSON.parse(@client.post("/v1/virtualcards/#{@id}/email", { email: address }).body)["data"]
|
121
|
+
end
|
122
|
+
|
123
|
+
def delete
|
124
|
+
@client.delete("/v1/virtualcards/#{@id}")
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
class SVBClient::VirtualCardHandler
|
129
|
+
def initialize(client)
|
130
|
+
raise 'provide an API client' if client.nil?
|
131
|
+
@client = client
|
132
|
+
end
|
133
|
+
|
134
|
+
def create(card_data)
|
135
|
+
response = @client.post('/v1/virtualcards', card_data)
|
136
|
+
SVBClient::VirtualCard.new(@client, JSON.parse(response.body)["data"]["id"])
|
137
|
+
end
|
138
|
+
|
139
|
+
def get(id)
|
140
|
+
@client.get("/v1/virtualcards/#{id}")
|
141
|
+
SVBClient::VirtualCard.new(@client, id)
|
142
|
+
end
|
143
|
+
|
144
|
+
def all(filters: [])
|
145
|
+
response = @client.get("/v1/virtualcards", filters.join('&'))
|
146
|
+
list = JSON.parse(response.body)["data"]
|
147
|
+
list.map do |card|
|
148
|
+
SVBClient::VirtualCard.new(@client, card["id"])
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
104
153
|
class SVBClient::ACH
|
105
154
|
def initialize(client, id)
|
106
155
|
@client = client
|