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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/svbclient.rb +49 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e2293f322ab232c27811ac01f771940fd47643c
4
- data.tar.gz: e10b4783b0546ae476c07db5709a35d87646b762
3
+ metadata.gz: df1dfa58bb26e3392d829fe51cbdf7e5e4b4415e
4
+ data.tar.gz: 69dea9e6a0ab2a478db72ab052d0e2ac2c7f871e
5
5
  SHA512:
6
- metadata.gz: 29aaed3d9e418e1fa21d9b7395b8595c0af576483cc344d32e8fd684d9e03ba23ecea6dd53a633167eef378dfbdfc2f7e1865cb1d616fd99379ed2141c8b1742
7
- data.tar.gz: a4fcfa2ae7de155ff35e6dba8448a57b7b343715ab011fd8f86ee12ffd98a2ac54419b3c4fe9491c8f9a6e748777019b6527e568954ef9469e59fb85e68da3a6
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svbclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.3
4
+ version: 3.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Silicon Valley Bank