plaid 6.0.0 → 13.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +16 -18
- data/.github/workflows/add_to_project.yml +21 -0
- data/.rubocop.yml +2 -2
- data/CHANGELOG.md +176 -25
- data/CONTRIBUTING.md +10 -4
- data/Gemfile.lock +16 -8
- data/PUBLISH.md +20 -0
- data/README.md +58 -18
- data/Rakefile +2 -1
- data/lib/plaid.rb +9 -2
- data/lib/plaid/client.rb +39 -13
- data/lib/plaid/errors.rb +7 -2
- data/lib/plaid/models.rb +1498 -17
- data/lib/plaid/products/asset_report.rb +199 -0
- data/lib/plaid/products/base_product.rb +0 -5
- data/lib/plaid/products/deposit_switch.rb +99 -0
- data/lib/plaid/products/identity.rb +1 -6
- data/lib/plaid/products/institutions.rb +26 -11
- data/lib/plaid/products/investments.rb +127 -0
- data/lib/plaid/products/item.rb +34 -182
- data/lib/plaid/products/liabilities.rb +39 -0
- data/lib/plaid/products/link_token.rb +74 -0
- data/lib/plaid/products/payment_initiation.rb +251 -0
- data/lib/plaid/products/processor.rb +72 -0
- data/lib/plaid/products/sandbox.rb +115 -0
- data/lib/plaid/products/transactions.rb +15 -0
- data/lib/plaid/products/webhooks.rb +23 -0
- data/lib/plaid/version.rb +2 -2
- data/plaid.gemspec +1 -1
- metadata +13 -6
- data/PUBLISHING.md +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d4032f5d56f2e441caf24526b827c17248114fdcc986fe9595134b180e3b7386
|
4
|
+
data.tar.gz: 1584b89290e96f0ef895e1f3401c51b8914e4391d2c4d9862c76f7b390fe065b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a24eef51a825719aa30edb6a3165272f8d38db81d23b3130e5b09a8c33571bfda06e661e030c8c8a1bde0efa60f33fa7a60f22b22a8d5686c691b718c71adb01
|
7
|
+
data.tar.gz: 4ae990701822770f0098b5e48bac694427a3b6a11ffb626a120cdb281db6caf36daee34fe39aaee4866cca0c30e52ab50c2508630ce929f30368f45ab2bca55a
|
data/.circleci/config.yml
CHANGED
@@ -1,23 +1,21 @@
|
|
1
1
|
version: 2
|
2
|
-
|
3
2
|
jobs:
|
4
3
|
build:
|
5
4
|
docker:
|
6
|
-
|
5
|
+
- image: circleci/ruby:2.4
|
7
6
|
steps:
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
7
|
+
- checkout
|
8
|
+
- run:
|
9
|
+
name: Bundle Install
|
10
|
+
command: bundle check || bundle install
|
11
|
+
- run:
|
12
|
+
name: Stubbed API test
|
13
|
+
command: bundle exec rake test
|
14
|
+
environment:
|
15
|
+
STUB_API: true
|
16
|
+
- run:
|
17
|
+
name: Live API test
|
18
|
+
command: bundle exec rake test
|
19
|
+
- run:
|
20
|
+
name: Rubocop test
|
21
|
+
command: bundle exec rubocop
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name: Auto Assign to CLIB Project
|
2
|
+
|
3
|
+
on:
|
4
|
+
issues:
|
5
|
+
types: [opened]
|
6
|
+
pull_request:
|
7
|
+
types: [opened]
|
8
|
+
env:
|
9
|
+
MY_GITHUB_TOKEN: ${{ secrets.CLIB_AUTOMATION_TOKEN }
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
assign_one_project:
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
name: Assign to One Project
|
15
|
+
steps:
|
16
|
+
- name: Assign NEW issues and NEW pull requests to project 1
|
17
|
+
uses: srggrs/assign-one-project-github-action@1.2.0
|
18
|
+
if: github.event.action == 'opened'
|
19
|
+
with:
|
20
|
+
project: 'https://github.com/orgs/plaid/projects/1'
|
21
|
+
column_name: 'Needs Investigation'
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.
|
2
|
+
TargetRubyVersion: 2.4
|
3
3
|
|
4
4
|
Style/FrozenStringLiteralComment:
|
5
5
|
Enabled: false
|
@@ -8,7 +8,7 @@ Layout/IndentHeredoc:
|
|
8
8
|
Enabled: false
|
9
9
|
|
10
10
|
Metrics/AbcSize:
|
11
|
-
|
11
|
+
Enabled: false
|
12
12
|
|
13
13
|
Metrics/MethodLength:
|
14
14
|
Max: 20
|
data/CHANGELOG.md
CHANGED
@@ -1,57 +1,208 @@
|
|
1
|
+
## 13.2.0
|
2
|
+
- Add support for `options` to `/payment_initiation/payment/create`
|
3
|
+
|
4
|
+
# 13.1.0
|
5
|
+
- Add Standing Orders support to Payment Initiation
|
6
|
+
|
7
|
+
# 13.0.1
|
8
|
+
- Add `update_type` to `Item` model.
|
9
|
+
|
10
|
+
# 13.0.0
|
11
|
+
- Add support for providing a payment initiation schedule
|
12
|
+
- Add back the (now deprecated) `/item/public_token/create` endpoint
|
13
|
+
- Add back the (now deprecated) `/payment_initiation/payment/token/create` endpoint
|
14
|
+
|
15
|
+
BREAKING CHANGES:
|
16
|
+
|
17
|
+
- Update minimum required Ruby version to 2.4
|
18
|
+
|
19
|
+
# 12.0.0
|
20
|
+
|
21
|
+
- The library has been pinned to the '2020-09-14' API release. Visit the [docs](https://plaid.com/docs/api/versioning/) to see what changed.
|
22
|
+
- the `/item/public_token/create` endpoint has been disabled in favor of the /link/token/create
|
23
|
+
endpoint
|
24
|
+
- The `/item/add_token/create endpoint` has been disabled in favor of the /link/token/create
|
25
|
+
- The `/payment_initiation/payment/token/create` endpoint has been disabled in favor of the /link/token/create
|
26
|
+
endpoint
|
27
|
+
- The `/item/remove` endpoint will no longer return a `removed` boolean.
|
28
|
+
- The `/institutions/get`, `/institutions/get_by_id`, and `/institutions/search` now require
|
29
|
+
`country_codes` to be passed in.
|
30
|
+
|
31
|
+
# 11.1.0
|
32
|
+
|
33
|
+
- Add support for Link Token get endpoint ([#301](https://github.com/plaid/plaid-ruby/pull/301))
|
34
|
+
- `link/token/get`
|
35
|
+
|
36
|
+
# 11.0.0
|
37
|
+
|
38
|
+
- Add `merchant_name` to `Transaction` (#294)
|
39
|
+
|
40
|
+
BREAKING CHANGES:
|
41
|
+
|
42
|
+
- Removes the public key as input to `Client`. The public key is no longer needed by the API. (#287)
|
43
|
+
- Add link/token/create support (#293)
|
44
|
+
|
45
|
+
# 10.1.0
|
46
|
+
|
47
|
+
- Add support for more options (`override_username`, `override_password`) in the `/sandbox/public_token/create` endpoint ([219](https://github.com/plaid/plaid-ruby/pull/219))
|
48
|
+
|
49
|
+
# 10.0.0
|
50
|
+
|
51
|
+
- Add support for optional user fields for `/item/add_token/create` endpoint ([278](https://github.com/plaid/plaid-ruby/pull/278))
|
52
|
+
- Add support for credit card liabilities ([286](https://github.com/plaid/plaid-ruby/pull/286))
|
53
|
+
|
54
|
+
BREAKING CHANGES:
|
55
|
+
|
56
|
+
- `RATE_LIMIT_EXCEEDED` Plaid error types will be correctly mapped to `RateLimitExceededError` ([285](https://github.com/plaid/plaid-ruby/pull/285))
|
57
|
+
- `INSTITUTION_ERROR` Plaid error types will be correctly mapped to `InstitutionError` ([275](https://github.com/plaid/plaid-ruby/pull/275))
|
58
|
+
- Enable payment recipient to be created with BACS ([288](https://github.com/plaid/plaid-ruby/pull/288))
|
59
|
+
|
60
|
+
# 9.0.0
|
61
|
+
|
62
|
+
- Adds support for `/sandbox/item/set_verification_status`
|
63
|
+
- Removes support for deprecated `/item/access_token/update_version` endpoint
|
64
|
+
|
65
|
+
BREAKING CHANGES:
|
66
|
+
|
67
|
+
- Removes `client.item.update_version`
|
68
|
+
|
69
|
+
# 8.9.0 16-Apr-2020
|
70
|
+
|
71
|
+
- Add client_user_id to Item add token endpoint ([#274](https://github.com/plaid/plaid-ruby/pull/274))
|
72
|
+
|
73
|
+
# 8.8.0 02-Apr-2020
|
74
|
+
|
75
|
+
- Add support for Item add token endpoint (BETA) ([#269](https://github.com/plaid/plaid-ruby/pull/269))
|
76
|
+
- `/item/add_token/create`
|
77
|
+
|
78
|
+
# 8.7.0 05-Mar-2020
|
79
|
+
|
80
|
+
- Add transaction_code to Transaction class ([#264](https://github.com/plaid/plaid-ruby/pull/264))
|
81
|
+
- Add OAuth support to /institutions endpoints ([#261](https://github.com/plaid/plaid-ruby/pull/261))
|
82
|
+
|
83
|
+
# 8.6.0 20-Feb-2020
|
84
|
+
|
85
|
+
- Add support for transactions refresh product ([#258](https://github.com/plaid/plaid-ruby/pull/258))
|
86
|
+
- `/transactions/refresh`
|
87
|
+
|
88
|
+
# 8.5.0 10-Feb-2020
|
89
|
+
|
90
|
+
- Add support for deposit switch product ([#251](https://github.com/plaid/plaid-ruby/pull/251))
|
91
|
+
- Add support for generic processor token ([#256](https://github.com/plaid/plaid-ruby/pull/256))
|
92
|
+
- Add support for webhook verification ([#249](https://github.com/plaid/plaid-ruby/pull/249))
|
93
|
+
|
94
|
+
# 8.4.0 23-Jan-2020
|
95
|
+
|
96
|
+
- Add support for new UK Payment Initiation product ([#246](https://github.com/plaid/plaid-ruby/pull/246))
|
97
|
+
- `/payment_initiation/recipient/create`
|
98
|
+
- `/payment_initiation/recipient/get`
|
99
|
+
- `/payment_initiation/recipient/list`
|
100
|
+
- `/payment_initiation/payment/create`
|
101
|
+
- `/payment_initiation/payment/token/create`
|
102
|
+
- `/payment_initiation/payment/get`
|
103
|
+
- `/payment_initiation/payment/list`
|
104
|
+
- Add `consent_expiration_time` to the Item interface ([#247](https://github.com/plaid/plaid-ruby/pull/247))
|
105
|
+
|
106
|
+
# 8.3.0 17-Sep-2019
|
107
|
+
|
108
|
+
- Add support for new [Ocrolus Partnership](https://plaid.com/docs/ocrolus/)
|
109
|
+
|
110
|
+
# 8.2.0 16-Sep-2019
|
111
|
+
|
112
|
+
- Update Assets schema for international address support
|
113
|
+
|
114
|
+
# 8.1.0 23-Jul-2019
|
115
|
+
|
116
|
+
- Add binding for the new [liabilities product](https://plaid.com/docs/api/#liabilities)
|
117
|
+
|
118
|
+
# 8.0.0 19-Jun-2019
|
119
|
+
|
120
|
+
- Deprecate direct integration as it is no longer supported
|
121
|
+
|
122
|
+
# 7.1.0 17-Jun-2019
|
123
|
+
|
124
|
+
- Add bindings for the new [investments product](https://plaid.com/docs/api/#investments).
|
125
|
+
|
126
|
+
# 7.0.0 20-May-2019
|
127
|
+
|
128
|
+
- Add support for 2019-05-29 API version
|
129
|
+
|
130
|
+
# 6.3.1 20-Mar-2019
|
131
|
+
|
132
|
+
- Remove unnecessary log line
|
133
|
+
|
134
|
+
# 6.3.0 5-Mar-2019
|
135
|
+
|
136
|
+
- Add support for include_institution_data to /institutions/search endpoint.
|
137
|
+
- Add support for include_institution_data to /institutions/get endpoint.
|
138
|
+
- Add support for include_institution data to /institutions/get_by_id endpoint.
|
139
|
+
|
140
|
+
# 6.2.1 14-Feb-2019
|
141
|
+
|
142
|
+
- Fix error models to support assets-related errors.
|
143
|
+
|
144
|
+
# 6.2.0 28-Nov-2018
|
145
|
+
|
146
|
+
- Assets + Insights reports
|
147
|
+
|
148
|
+
# 6.1.0 20-Jun-2018
|
149
|
+
|
150
|
+
- Add bindings for the new [assets product](https://plaid.com/docs/api/#assets).
|
151
|
+
|
1
152
|
# 6.0.0 22-May-2018
|
2
153
|
|
3
|
-
|
4
|
-
|
5
|
-
|
154
|
+
- Use `Plaid-Version` header to request the certain compatible API version.
|
155
|
+
- Change Auth-related data structures to conform to the API.
|
156
|
+
- Include currency-related fields for transaction and account objects.
|
6
157
|
|
7
158
|
# 5.0.0 23-Mar-2018
|
8
159
|
|
9
|
-
|
160
|
+
- Introduce true response objects instead of deep nested hashes. Any of the
|
10
161
|
three syntaxes can be used interchangeably for any API response:
|
11
162
|
`response['foo']['bar']`, `response[:foo][:bar]`, or `response.foo.bar`.
|
12
|
-
|
163
|
+
- Add Dwolla and Apex products.
|
13
164
|
|
14
165
|
# 4.1.0 04-Jan-2018
|
15
166
|
|
16
|
-
|
17
|
-
|
18
|
-
|
167
|
+
- Make `/item/remove` the primary Item removal endpoint
|
168
|
+
- Add #options parameter to `/institutions/get`
|
169
|
+
- Handle network errors with `PlaidServerError`
|
19
170
|
|
20
171
|
# 4.0.0 09-Mar-2017
|
21
172
|
|
22
|
-
|
173
|
+
- Refactored the entire library to support [Plaid's new API](https://blog.plaid.com/improving-our-api/). Use the [transition guide](https://plaid.com/docs/link/transition-guide) to update your integration. Version 3.x.x of this gem is mirrored at [plaid-legacy](https://github.com/plaid/plaid-ruby-legacy).
|
23
174
|
|
24
175
|
# 3.0.0. 17-Jan-2017
|
25
176
|
|
26
|
-
|
177
|
+
- Add `/institutions/all` and `/institutions/all/search` endpoints, see [UPGRADING.md](UPGRADING.md#upgrading-from-2xx-to-300)
|
27
178
|
|
28
179
|
# 2.2.0. 03-Nov-2016
|
29
180
|
|
30
|
-
|
31
|
-
|
181
|
+
- Add `Transaction#reference_number` (@ericbirdsall).
|
182
|
+
- Fix webhook codes and add risk and income webhooks.
|
32
183
|
|
33
184
|
# 2.1.0. 19-Oct-2016
|
34
185
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
186
|
+
- Documentation fixes (@ishmael).
|
187
|
+
- Fix `Transaction#to_s` behavior (@michel-tricot).
|
188
|
+
- PATCH `/:product/step` flow.
|
189
|
+
- Use the same client in `User#upgrade` (@betesh).
|
190
|
+
- Webhook object (@zshannon).
|
191
|
+
- `processor_token` access in `User.exchange_token` (@gylaz).
|
192
|
+
- Raise `ServerError` in case server returned an empty response body.
|
42
193
|
|
43
194
|
# 2.0.0. 24-May-2016
|
44
195
|
|
45
|
-
|
46
|
-
|
196
|
+
- Use `~> 1.0` spec for multi_json dependency.
|
197
|
+
- Support `stripe_bank_account_token` in `User.exchange_token`.
|
47
198
|
|
48
199
|
# 2.0.0.alpha.2. 14-May-2016
|
49
200
|
|
50
|
-
|
201
|
+
- Use `:production` instead of `:api` to signify production environment
|
51
202
|
in `Plaid::Client#env=`.
|
52
|
-
|
53
|
-
|
203
|
+
- `User#mfa_step` allows to specify options now (thanks @gcweeks).
|
204
|
+
- Implemented `User#update_webhook`.
|
54
205
|
|
55
206
|
# 2.0.0.alpha. 06-May-2016
|
56
207
|
|
57
|
-
|
208
|
+
- Rewrite everything.
|
data/CONTRIBUTING.md
CHANGED
@@ -8,14 +8,13 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
8
8
|
|
9
9
|
The gem test suite can be run in two modes. By default, it runs against the
|
10
10
|
live sandbox environment, creating items on the fly and calling various API
|
11
|
-
endpoints for them. For this to work you'll need real `client_id
|
12
|
-
|
13
|
-
|
11
|
+
endpoints for them. For this to work you'll need real `client_id` and `secret`
|
12
|
+
from your Plaid dashboard. Create a file named `.env` based on `.env.sample`
|
13
|
+
which is provided:
|
14
14
|
|
15
15
|
```text
|
16
16
|
PLAID_RUBY_CLIENT_ID=the_real_client_id
|
17
17
|
PLAID_RUBY_SECRET=the_real_secret
|
18
|
-
PLAID_RUBY_PUBLIC_KEY=the_real_public_key
|
19
18
|
```
|
20
19
|
This file will be loaded during the tests.
|
21
20
|
|
@@ -44,6 +43,13 @@ changes in API you'll need to update the pre-recorded responses. Here's how:
|
|
44
43
|
stubbed ones used by `STUB_API=1 rake test`.
|
45
44
|
4. Run `STUB_API=1 rake test` and verify that everything works.
|
46
45
|
|
46
|
+
|
47
|
+
## Running lint
|
48
|
+
|
49
|
+
```bash
|
50
|
+
bundle exec rubocop
|
51
|
+
```
|
52
|
+
|
47
53
|
## Contributing
|
48
54
|
|
49
55
|
1. Make one or more atomic commits, and ensure that each commit has a
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
plaid (
|
4
|
+
plaid (13.2.0)
|
5
5
|
faraday
|
6
6
|
faraday_middleware
|
7
7
|
hashie (>= 3.4.3)
|
@@ -11,21 +11,28 @@ GEM
|
|
11
11
|
specs:
|
12
12
|
ast (2.4.0)
|
13
13
|
dotenv (2.4.0)
|
14
|
-
faraday (
|
14
|
+
faraday (1.4.1)
|
15
|
+
faraday-excon (~> 1.1)
|
16
|
+
faraday-net_http (~> 1.0)
|
17
|
+
faraday-net_http_persistent (~> 1.1)
|
15
18
|
multipart-post (>= 1.2, < 3)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
ruby2_keywords (>= 0.0.4)
|
20
|
+
faraday-excon (1.1.0)
|
21
|
+
faraday-net_http (1.0.1)
|
22
|
+
faraday-net_http_persistent (1.1.0)
|
23
|
+
faraday_middleware (1.0.0)
|
24
|
+
faraday (~> 1.0)
|
25
|
+
hashie (4.1.0)
|
19
26
|
minitest (5.11.3)
|
20
27
|
minitest-around (0.4.1)
|
21
28
|
minitest (~> 5.0)
|
22
|
-
multipart-post (2.
|
29
|
+
multipart-post (2.1.1)
|
23
30
|
parallel (1.12.1)
|
24
31
|
parser (2.5.1.0)
|
25
32
|
ast (~> 2.4.0)
|
26
33
|
powerpack (0.1.1)
|
27
34
|
rainbow (3.0.0)
|
28
|
-
rake (12.3.
|
35
|
+
rake (12.3.3)
|
29
36
|
rdoc (6.0.4)
|
30
37
|
rubocop (0.53.0)
|
31
38
|
parallel (~> 1.10)
|
@@ -35,6 +42,7 @@ GEM
|
|
35
42
|
ruby-progressbar (~> 1.7)
|
36
43
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
37
44
|
ruby-progressbar (1.9.0)
|
45
|
+
ruby2_keywords (0.0.4)
|
38
46
|
sdoc (1.0.0)
|
39
47
|
rdoc (>= 5.0)
|
40
48
|
unicode-display_width (1.3.2)
|
@@ -55,4 +63,4 @@ DEPENDENCIES
|
|
55
63
|
vcr (~> 4.0.0)
|
56
64
|
|
57
65
|
BUNDLED WITH
|
58
|
-
1.
|
66
|
+
1.17.2
|
data/PUBLISH.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Publishing
|
2
|
+
|
3
|
+
The module is published to [RubyGems][1] under the gem name [plaid][2].
|
4
|
+
|
5
|
+
Prepare release:
|
6
|
+
|
7
|
+
1. update `lib/plaid/version.rb`, and `CHANGELOG.md` files.
|
8
|
+
2. run `bundle` to bump the version in `Gemfile.lock`
|
9
|
+
3. create and merge a PR with the changes from 1 and 2.
|
10
|
+
4. authenticate with rubygems with `gem signin` or manually set up your `~/.gem/credentials`
|
11
|
+
|
12
|
+
Publish:
|
13
|
+
|
14
|
+
1. `git checkout master` and `git pull` (makes sure your `HEAD` is up-to-date).
|
15
|
+
2. Check that tests are passing on latest `master` build and (optional) `bundle exec rake test` to run tests locally
|
16
|
+
3. `bundle exec rake release` (builds the gem, creates a tag, pushes the gem to RubyGems and tag to GitHub). **NOTE:** if this step hangs indefinitely, you need to set your MFA settings to "UI Only" [here](https://rubygems.org/profile/edit)
|
17
|
+
4. `bundle exec rake update_github_docs` (generates RDoc files, updates `gh-pages` branch and pushes it to GitHub). (If you run into a `gh-pages` branch error, you may need to manually run `git checkout gh-pages` to ensure the branch is checked out locally.)
|
18
|
+
|
19
|
+
[1]: https://rubygems.org/
|
20
|
+
[2]: https://rubygems.org/gems/plaid
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# plaid-ruby [![Circle CI](https://circleci.com/gh/plaid/plaid-ruby.svg?style=svg&circle-token=30ee002ac2021da5b5b5a701d45fe2888af124a5)](https://circleci.com/gh/plaid/plaid-ruby) [![Gem Version](https://badge.fury.io/rb/plaid.svg)](http://badge.fury.io/rb/plaid)
|
2
2
|
|
3
|
-
|
3
|
+
:warning: After 7/12/21, this major version of the library will only receive critical security patches. Please consider trying out our new [beta version](https://github.com/plaid/plaid-ruby/tree/14.0.0-beta-release).
|
4
4
|
|
5
|
-
|
5
|
+
The official Ruby bindings for the [Plaid API](https://plaid.com/docs).
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -20,7 +20,21 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
$ gem install plaid
|
22
22
|
|
23
|
-
The gem supports Ruby 2.
|
23
|
+
The gem supports Ruby 2.2+ only.
|
24
|
+
|
25
|
+
### Versioning
|
26
|
+
|
27
|
+
Each major version of `plaid-ruby` targets a specific version of the Plaid API:
|
28
|
+
|
29
|
+
| API version | plaid-ruby release |
|
30
|
+
| ----------- | ------------------ |
|
31
|
+
| [`2020-09-14`][api-version-2020-09-14] (**latest**) | `12.x.x` |
|
32
|
+
| [`2019-05-29`][api-version-2019-05-29] (**latest**) | `11.x.x`, `10.x.x`, `9.x.x`, `8.x.x`, `7.x.x` |
|
33
|
+
| [`2018-05-22`][api-version-2018-05-22] | `6.x.x` |
|
34
|
+
| `2017-03-08` | `5.x.x` |
|
35
|
+
|
36
|
+
For information about what has changed between versions and how to update your integration, head to the [version changelog][version-changelog].
|
37
|
+
|
24
38
|
|
25
39
|
## Usage
|
26
40
|
|
@@ -30,15 +44,14 @@ The RubyDoc for the gem is available [here](http://plaid.github.io/plaid-ruby/).
|
|
30
44
|
|
31
45
|
### Creating a Plaid client
|
32
46
|
|
33
|
-
Create an instance of the client using the `client_id
|
47
|
+
Create an instance of the client using the `client_id` and `secret` from your Plaid dashboard along with your environment of choice:
|
34
48
|
|
35
49
|
```ruby
|
36
50
|
require 'plaid'
|
37
51
|
|
38
52
|
client = Plaid::Client.new(env: :sandbox,
|
39
53
|
client_id: '***',
|
40
|
-
secret: '***'
|
41
|
-
public_key: '***')
|
54
|
+
secret: '***')
|
42
55
|
```
|
43
56
|
|
44
57
|
The `env` field is the environment which the client will be running in. Your choices for the `env` field include:
|
@@ -52,7 +65,7 @@ The `env` field is the environment which the client will be running in. Your cho
|
|
52
65
|
The gem uses Faraday to wrap HTTPS connections, which allows you to tune certain params:
|
53
66
|
|
54
67
|
```ruby
|
55
|
-
client = Plaid::Client.new(env: :sandbox, client_id: '***', secret: '***'
|
68
|
+
client = Plaid::Client.new(env: :sandbox, client_id: '***', secret: '***') do |builder|
|
56
69
|
Plaid::Client.build_default_connection(builder)
|
57
70
|
|
58
71
|
# Increase network timeout
|
@@ -62,6 +75,27 @@ end
|
|
62
75
|
|
63
76
|
## Examples
|
64
77
|
|
78
|
+
### Create a new link_token
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
# Grab the client_user_id by searching for the current user in your database
|
82
|
+
user = User.find_by!(email: '***')
|
83
|
+
client_user_id = user.id
|
84
|
+
|
85
|
+
# Create the link_token with all of your configurations
|
86
|
+
link_token_response = client.link_token.create(
|
87
|
+
user: { client_user_id: client_user_id.to_s },
|
88
|
+
client_name: 'My app',
|
89
|
+
products: %w[auth transactions],
|
90
|
+
country_codes: ['US'],
|
91
|
+
language: 'en'
|
92
|
+
)
|
93
|
+
|
94
|
+
# Pass the result to your client-side app to initialize Link
|
95
|
+
# and retrieve a public_token
|
96
|
+
link_token = link_token_response.link_token
|
97
|
+
```
|
98
|
+
|
65
99
|
### Exchanging a Link public_token for a Plaid access_token
|
66
100
|
|
67
101
|
If you have a [Link](https://github.com/plaid/link) `public token`, use this function to get an `access_token`: `client.item.public_token.exchange(public_token)`
|
@@ -73,6 +107,7 @@ response = client.item.public_token.exchange(public_token)
|
|
73
107
|
access_token = response.access_token
|
74
108
|
```
|
75
109
|
|
110
|
+
|
76
111
|
### Deleting an item
|
77
112
|
|
78
113
|
```ruby
|
@@ -80,8 +115,7 @@ require 'plaid'
|
|
80
115
|
|
81
116
|
client = Plaid::Client.new(env: :sandbox,
|
82
117
|
client_id: '***',
|
83
|
-
secret: '***'
|
84
|
-
public_key: '***')
|
118
|
+
secret: '***')
|
85
119
|
|
86
120
|
exchange_token_response = client.item.public_token.exchange('[Plaid Link public_token]')
|
87
121
|
access_token = exchange_token_response.access_token
|
@@ -96,8 +130,7 @@ require 'plaid'
|
|
96
130
|
|
97
131
|
client = Plaid::Client.new(env: :sandbox,
|
98
132
|
client_id: '***',
|
99
|
-
secret: '***'
|
100
|
-
public_key: '***')
|
133
|
+
secret: '***')
|
101
134
|
|
102
135
|
exchange_token_response = client.item.public_token.exchange('[Plaid Link public_token]')
|
103
136
|
access_token = exchange_token_response.access_token
|
@@ -125,8 +158,7 @@ require 'plaid'
|
|
125
158
|
|
126
159
|
client = Plaid::Client.new(env: :sandbox,
|
127
160
|
client_id: '***',
|
128
|
-
secret: '***'
|
129
|
-
public_key: '***')
|
161
|
+
secret: '***')
|
130
162
|
|
131
163
|
exchange_token_response = client.item.public_token.exchange('[Plaid Link public_token]')
|
132
164
|
access_token = exchange_token_response.access_token
|
@@ -143,8 +175,7 @@ require 'plaid'
|
|
143
175
|
|
144
176
|
client = Plaid::Client.new(env: :sandbox,
|
145
177
|
client_id: '***',
|
146
|
-
secret: '***'
|
147
|
-
public_key: '***')
|
178
|
+
secret: '***')
|
148
179
|
|
149
180
|
exchange_token_response = client.item.public_token.exchange('[Plaid Link public_token]')
|
150
181
|
access_token = exchange_token_response.access_token
|
@@ -161,6 +192,8 @@ There are also a number of other methods you can use to retrieve data:
|
|
161
192
|
* `client.identity.get(access_token, ...)`: identity
|
162
193
|
* `client.transactions.get(access_token, ...)`: transactions
|
163
194
|
* `client.credit_details.get(access_token, ...)`: credit details
|
195
|
+
* `client.investments.transactions.get(access_token, ...)`: investment-account transactions
|
196
|
+
* `client.investments.holdings.get(access_token, ...)`: investment-account holdings
|
164
197
|
|
165
198
|
All of these methods return appropriate data. More information can be found on the [API documentation](https://plaid.com/docs/api).
|
166
199
|
|
@@ -195,6 +228,8 @@ Any methods making API calls will result in an exception raised unless the respo
|
|
195
228
|
|
196
229
|
`Plaid::ItemError` indicates that information provided for the Item (such as credentials or MFA) may be invalid or that the Item is not supported on Plaid's platform.
|
197
230
|
|
231
|
+
`Plaid::InstitutionError` is returned when there are errors for the requested financial institution.
|
232
|
+
|
198
233
|
Read more about response codes and their meaning in the
|
199
234
|
[Plaid documentation](https://plaid.com/docs/api).
|
200
235
|
|
@@ -205,8 +240,6 @@ Any API call returns a response object which is accessible by dot notation
|
|
205
240
|
and `response['foo']['bar']`. Expected keys for all types of responses are defined,
|
206
241
|
and any attempt to access an unknown key will cause `NoMethodError` exception.
|
207
242
|
|
208
|
-
These strict model checks can be disabled by setting `Plaid.relaxed_models = true`.
|
209
|
-
|
210
243
|
## Network Timeout
|
211
244
|
|
212
245
|
A network timeout value is currently defaulted at 600 seconds = 10 minutes.
|
@@ -222,5 +255,12 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/plaid/
|
|
222
255
|
|
223
256
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
224
257
|
|
225
|
-
|
258
|
+
### Legacy API
|
259
|
+
|
260
|
+
If you're looking for a Ruby client that works with the legacy Plaid API, use the [`plaid-legacy` gem][2].
|
261
|
+
|
226
262
|
[2]: https://github.com/plaid/plaid-ruby-legacy
|
263
|
+
[version-changelog]: https://plaid.com/docs/api/versioning/
|
264
|
+
[api-version-2018-05-22]: https://plaid.com/docs/api/versioning/#2018-05-22
|
265
|
+
[api-version-2019-05-29]: https://plaid.com/docs/api/versioning/#2019-05-29
|
266
|
+
[api-version-2020-09-14]: https://plaid.com/docs/api/versioning/#2020-09-14
|