plaid 2.0.0.alpha → 2.0.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +10 -10
- data/lib/plaid/client.rb +9 -7
- data/lib/plaid/user.rb +45 -3
- data/lib/plaid/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97bd694d424964634d8df55cf301f6a8ab743eb4
|
4
|
+
data.tar.gz: 3be0c9816df8e2c5917795cb40c3f70179dc60fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb45ff4e878c9eaba205aabc4cfbc94f066baa62fb67f7a091427826ff58c1e7b788c8d286f0f8d762c87f5d4938cb040b941917d393699e903600f9cd4556e7
|
7
|
+
data.tar.gz: 22a4587c8c0677660641892f0d68a2e746a665bdd8b9e5e595afb67cb702c7e964809c01bb26168ab6e2cdb36f012b1725c74589969a3adc8232d4ff7950cb5c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# 2.0.0.alpha.2. 14-May-2016
|
2
|
+
|
3
|
+
* Use `:production` instead of `:api` to signify production environment
|
4
|
+
in `Plaid::Client#env=`.
|
5
|
+
* `User#mfa_step` allows to specify options now (thanks @gcweeks).
|
6
|
+
* Implemented `User#update_webhook`.
|
7
|
+
|
1
8
|
# 2.0.0.alpha. 06-May-2016
|
2
9
|
|
3
10
|
* Rewrite everything.
|
data/README.md
CHANGED
@@ -44,19 +44,19 @@ end
|
|
44
44
|
user = Plaid::User.create(:connect, 'wells', 'plaid_test', 'plaid_good')
|
45
45
|
```
|
46
46
|
|
47
|
-
This call will do a `POST /connect`. The response will contain account information and transactions
|
47
|
+
This call will do a `POST /connect`. The response will contain account information and transactions
|
48
48
|
for last 30 days, which you can find in `user.accounts` and `user.initial_transactions`, accordingly.
|
49
49
|
|
50
50
|
If the authentication requires a pin, you can pass it as a named parameter:
|
51
51
|
|
52
52
|
```ruby
|
53
|
-
user = Plaid::User.create(:income, 'usaa', 'plaid_test', 'plaid_good',
|
53
|
+
user = Plaid::User.create(:income, 'usaa', 'plaid_test', 'plaid_good', pin: '1234')
|
54
54
|
```
|
55
55
|
|
56
56
|
To add options such as `login_only` or `webhook`, use `options` argument:
|
57
57
|
|
58
58
|
```ruby
|
59
|
-
user = Plaid::User.create(:connect, 'wells', 'plaid_test', 'plaid_good',
|
59
|
+
user = Plaid::User.create(:connect, 'wells', 'plaid_test', 'plaid_good',
|
60
60
|
options: { login_only: true, webhook: 'https://example.org/callbacks/plaid')
|
61
61
|
```
|
62
62
|
|
@@ -126,7 +126,7 @@ If MFA is requested by the financial institution, the `User.create` call would b
|
|
126
126
|
a bit differently:
|
127
127
|
|
128
128
|
```ruby
|
129
|
-
user = Plaid::User.create(:auth, 'wells', 'plaid_test', 'plaid_good')
|
129
|
+
user = Plaid::User.create(:auth, 'wells', 'plaid_test', 'plaid_good')
|
130
130
|
|
131
131
|
user.accounts #=> nil
|
132
132
|
user.mfa? #=> true
|
@@ -145,16 +145,16 @@ user.mfa #=> nil
|
|
145
145
|
user.accounts #=> [<Plaid::Account ...>, ...]
|
146
146
|
```
|
147
147
|
|
148
|
-
The code-based MFA workflow is similar. Basically you need to call `user.mfa_step(...)`
|
148
|
+
The code-based MFA workflow is similar. Basically you need to call `user.mfa_step(...)`
|
149
149
|
until `user.mfa?` becomes false.
|
150
150
|
|
151
151
|
### Obtaining user-related data
|
152
152
|
|
153
|
-
If you have a live `User` instance, you can use following methods
|
153
|
+
If you have a live `User` instance, you can use following methods
|
154
154
|
(independent of instance's current product):
|
155
155
|
|
156
156
|
* `user.transactions(...)`. Makes a `/connect/get` request.
|
157
|
-
* `user.auth(sync: false)`. Makes an `/auth/get` request.
|
157
|
+
* `user.auth(sync: false)`. Makes an `/auth/get` request.
|
158
158
|
* `user.info(sync: false)`. Makes an `/info/get` request.
|
159
159
|
* `user.income(sync: false)`. Makes an `/income/get` request.
|
160
160
|
* `user.risk(sync: false)`. Makes an `/risk/get` request.
|
@@ -176,7 +176,7 @@ loaded. Otherwise cached information will be returned:
|
|
176
176
|
|
177
177
|
```ruby
|
178
178
|
user = User.load(:auth, 'access_token') # Just set the token
|
179
|
-
user.auth # POST /auth/get
|
179
|
+
user.auth # POST /auth/get
|
180
180
|
user.auth # No POST, return cached info
|
181
181
|
user.auth(sync: true) # POST /auth/get again
|
182
182
|
```
|
@@ -207,11 +207,11 @@ res = Plaid::LongTailInstitution.search(query: 'c') # Lookup by name
|
|
207
207
|
|
208
208
|
### Custom clients
|
209
209
|
|
210
|
-
It's possible to use several Plaid environments and/or credentials in one app by
|
210
|
+
It's possible to use several Plaid environments and/or credentials in one app by
|
211
211
|
explicit instantiation of `Plaid::Client`:
|
212
212
|
|
213
213
|
```ruby
|
214
|
-
# Configuring the global client (Plaid.client) which is used by default
|
214
|
+
# Configuring the global client (Plaid.client) which is used by default
|
215
215
|
Plaid.config do |p|
|
216
216
|
p.client_id = 'client_id_1'
|
217
217
|
p.secret = 'secret_1'
|
data/lib/plaid/client.rb
CHANGED
@@ -14,12 +14,14 @@ module Plaid
|
|
14
14
|
|
15
15
|
# Public: Set Plaid environment to use.
|
16
16
|
#
|
17
|
-
# env - The Symbol (:tartan, :
|
17
|
+
# env - The Symbol (:tartan, :production), or a full String URL like
|
18
18
|
# 'https://tartan.plaid.com'.
|
19
19
|
def env=(env)
|
20
20
|
case env
|
21
|
-
when :tartan
|
22
|
-
@env =
|
21
|
+
when :tartan
|
22
|
+
@env = 'https://tartan.plaid.com/'
|
23
|
+
when :production
|
24
|
+
@env = 'https://api.plaid.com/'
|
23
25
|
when String
|
24
26
|
begin
|
25
27
|
URI.parse(env)
|
@@ -27,20 +29,20 @@ module Plaid
|
|
27
29
|
rescue
|
28
30
|
raise ArgumentError, 'Invalid URL in Plaid::Client.env' \
|
29
31
|
" (#{env.inspect}). " \
|
30
|
-
'Specify either Symbol (:tartan, :
|
31
|
-
"full URL, like 'https://tartan.plaid.com'"
|
32
|
+
'Specify either Symbol (:tartan, :production),' \
|
33
|
+
" or a full URL, like 'https://tartan.plaid.com'"
|
32
34
|
end
|
33
35
|
else
|
34
36
|
raise ArgumentError, 'Invalid value for Plaid::Client.env' \
|
35
37
|
" (#{env.inspect}): " \
|
36
|
-
'must be :tartan, :
|
38
|
+
'must be :tartan, :production, or a full URL, ' \
|
37
39
|
"e.g. 'https://tartan.plaid.com'"
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
41
43
|
# Public: Construct a Client instance.
|
42
44
|
#
|
43
|
-
# env - The Symbol (:tartan, :
|
45
|
+
# env - The Symbol (:tartan, :production), or a full String URL like
|
44
46
|
# 'https://tartan.plaid.com'.
|
45
47
|
# client_id - The String Plaid account client ID to authenticate requests.
|
46
48
|
# secret - The String Plaid account secret to authenticate requests.
|
data/lib/plaid/user.rb
CHANGED
@@ -163,13 +163,34 @@ module Plaid
|
|
163
163
|
# send_method - The Hash with code send method information.
|
164
164
|
# E.g. { type: 'phone' } or { mask: '123-...-4321' }.
|
165
165
|
# Default is first available email.
|
166
|
+
# options - the Hash options (default: {}):
|
167
|
+
# :list - The Boolean flag which would request the
|
168
|
+
# available send methods if the institution
|
169
|
+
# requires code-based MFA credential (default:
|
170
|
+
# false).
|
171
|
+
# :webhook - The String webhook URL. Used with :connect,
|
172
|
+
# :income, and :risk products (default: nil).
|
173
|
+
# :pending - The Boolean flag requesting to return
|
174
|
+
# pending transactions. Used with :connect
|
175
|
+
# product (default: false).
|
176
|
+
# :login_only - The Boolean option valid for initial
|
177
|
+
# authentication only. If set to false, the
|
178
|
+
# initial request will return transaction data
|
179
|
+
# based on the start_date and end_date.
|
180
|
+
# :start_date - The start Date from which to return
|
181
|
+
# transactions (default: 30 days ago).
|
182
|
+
# :end_date - The end Date to which transactions
|
183
|
+
# will be collected (default: today).
|
166
184
|
#
|
167
185
|
# Returns true if whole MFA process is completed, false otherwise.
|
168
|
-
def mfa_step(info = nil, send_method: nil)
|
186
|
+
def mfa_step(info = nil, send_method: nil, options: nil)
|
169
187
|
payload = { access_token: access_token }
|
170
188
|
payload[:mfa] = info if info
|
171
|
-
|
172
|
-
|
189
|
+
if options || send_method
|
190
|
+
options = {} unless options
|
191
|
+
options[:send_method] = send_method if send_method
|
192
|
+
payload[:options] = MultiJson.dump(options)
|
193
|
+
end
|
173
194
|
conn = Connector.new(product, :step, auth: true)
|
174
195
|
response = conn.post(payload)
|
175
196
|
|
@@ -231,6 +252,27 @@ module Plaid
|
|
231
252
|
self
|
232
253
|
end
|
233
254
|
|
255
|
+
# Public: Create or update the webhook for Connect.
|
256
|
+
#
|
257
|
+
# Does a PATCH /connect request.
|
258
|
+
#
|
259
|
+
# webhook - The String with webhook URL.
|
260
|
+
#
|
261
|
+
# Returns self.
|
262
|
+
def update_webhook(webhook)
|
263
|
+
raise ArgumentError, 'User#update_webhook only supported by Connect!' \
|
264
|
+
unless product == :connect
|
265
|
+
|
266
|
+
payload = {
|
267
|
+
access_token: access_token,
|
268
|
+
options: MultiJson.dump(webhook: webhook)
|
269
|
+
}
|
270
|
+
|
271
|
+
parse_response(Connector.new(:connect, auth: true, client: client)
|
272
|
+
.patch(payload))
|
273
|
+
self
|
274
|
+
end
|
275
|
+
|
234
276
|
# Public: Delete the user.
|
235
277
|
#
|
236
278
|
# Makes a delete request and freezes self to prevent further modifications
|
data/lib/plaid/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plaid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.alpha
|
4
|
+
version: 2.0.0.alpha.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Dashevskii
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|