plaid 8.1.0 → 13.1.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 +1 -1
- data/.github/workflows/add_to_project.yml +21 -0
- data/.rubocop.yml +2 -2
- data/CHANGELOG.md +146 -36
- data/CONTRIBUTING.md +3 -4
- data/Gemfile.lock +16 -8
- data/PUBLISH.md +20 -0
- data/README.md +39 -16
- data/Rakefile +1 -1
- data/lib/plaid.rb +4 -0
- data/lib/plaid/client.rb +21 -13
- data/lib/plaid/errors.rb +7 -2
- data/lib/plaid/models.rb +440 -40
- data/lib/plaid/products/base_product.rb +0 -5
- data/lib/plaid/products/deposit_switch.rb +99 -0
- data/lib/plaid/products/institutions.rb +15 -12
- data/lib/plaid/products/item.rb +29 -28
- data/lib/plaid/products/link_token.rb +74 -0
- data/lib/plaid/products/payment_initiation.rb +239 -0
- data/lib/plaid/products/processor.rb +72 -0
- data/lib/plaid/products/sandbox.rb +37 -9
- 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 -9
- 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: faabd7aeb11ab3291ac2880c309e6d2a92a454b6b61b3baa71f2dd9533eaeb87
|
4
|
+
data.tar.gz: aee18f2be7d98362bd75f67a55635320ce8f263a22d85773444c3d060961892d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9e6ed86ba538c82b45728e1fc3c98c5251f1a1ae2940b1e581ee256719bf6bb2b2aaf83627d872957470da844f91bb69112cf6393c3555994a31d8d94646ef9
|
7
|
+
data.tar.gz: 6a21a96833e9c34ffaeec35db943cfb03c14c92b851a7684605c579291238a6584525052b5c034d8ad58b78273b9e41c329b206cca44cce1cb4cbb1f43530972
|
data/.circleci/config.yml
CHANGED
@@ -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,95 +1,205 @@
|
|
1
|
+
# 13.1.0
|
2
|
+
- Add Standing Orders support to Payment Initiation
|
3
|
+
|
4
|
+
# 13.0.1
|
5
|
+
- Add `update_type` to `Item` model.
|
6
|
+
|
7
|
+
# 13.0.0
|
8
|
+
- Add support for providing a payment initiation schedule
|
9
|
+
- Add back the (now deprecated) `/item/public_token/create` endpoint
|
10
|
+
- Add back the (now deprecated) `/payment_initiation/payment/token/create` endpoint
|
11
|
+
|
12
|
+
BREAKING CHANGES:
|
13
|
+
|
14
|
+
- Update minimum required Ruby version to 2.4
|
15
|
+
|
16
|
+
# 12.0.0
|
17
|
+
|
18
|
+
- 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.
|
19
|
+
- the `/item/public_token/create` endpoint has been disabled in favor of the /link/token/create
|
20
|
+
endpoint
|
21
|
+
- The `/item/add_token/create endpoint` has been disabled in favor of the /link/token/create
|
22
|
+
- The `/payment_initiation/payment/token/create` endpoint has been disabled in favor of the /link/token/create
|
23
|
+
endpoint
|
24
|
+
- The `/item/remove` endpoint will no longer return a `removed` boolean.
|
25
|
+
- The `/institutions/get`, `/institutions/get_by_id`, and `/institutions/search` now require
|
26
|
+
`country_codes` to be passed in.
|
27
|
+
|
28
|
+
# 11.1.0
|
29
|
+
|
30
|
+
- Add support for Link Token get endpoint ([#301](https://github.com/plaid/plaid-ruby/pull/301))
|
31
|
+
- `link/token/get`
|
32
|
+
|
33
|
+
# 11.0.0
|
34
|
+
|
35
|
+
- Add `merchant_name` to `Transaction` (#294)
|
36
|
+
|
37
|
+
BREAKING CHANGES:
|
38
|
+
|
39
|
+
- Removes the public key as input to `Client`. The public key is no longer needed by the API. (#287)
|
40
|
+
- Add link/token/create support (#293)
|
41
|
+
|
42
|
+
# 10.1.0
|
43
|
+
|
44
|
+
- 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))
|
45
|
+
|
46
|
+
# 10.0.0
|
47
|
+
|
48
|
+
- Add support for optional user fields for `/item/add_token/create` endpoint ([278](https://github.com/plaid/plaid-ruby/pull/278))
|
49
|
+
- Add support for credit card liabilities ([286](https://github.com/plaid/plaid-ruby/pull/286))
|
50
|
+
|
51
|
+
BREAKING CHANGES:
|
52
|
+
|
53
|
+
- `RATE_LIMIT_EXCEEDED` Plaid error types will be correctly mapped to `RateLimitExceededError` ([285](https://github.com/plaid/plaid-ruby/pull/285))
|
54
|
+
- `INSTITUTION_ERROR` Plaid error types will be correctly mapped to `InstitutionError` ([275](https://github.com/plaid/plaid-ruby/pull/275))
|
55
|
+
- Enable payment recipient to be created with BACS ([288](https://github.com/plaid/plaid-ruby/pull/288))
|
56
|
+
|
57
|
+
# 9.0.0
|
58
|
+
|
59
|
+
- Adds support for `/sandbox/item/set_verification_status`
|
60
|
+
- Removes support for deprecated `/item/access_token/update_version` endpoint
|
61
|
+
|
62
|
+
BREAKING CHANGES:
|
63
|
+
|
64
|
+
- Removes `client.item.update_version`
|
65
|
+
|
66
|
+
# 8.9.0 16-Apr-2020
|
67
|
+
|
68
|
+
- Add client_user_id to Item add token endpoint ([#274](https://github.com/plaid/plaid-ruby/pull/274))
|
69
|
+
|
70
|
+
# 8.8.0 02-Apr-2020
|
71
|
+
|
72
|
+
- Add support for Item add token endpoint (BETA) ([#269](https://github.com/plaid/plaid-ruby/pull/269))
|
73
|
+
- `/item/add_token/create`
|
74
|
+
|
75
|
+
# 8.7.0 05-Mar-2020
|
76
|
+
|
77
|
+
- Add transaction_code to Transaction class ([#264](https://github.com/plaid/plaid-ruby/pull/264))
|
78
|
+
- Add OAuth support to /institutions endpoints ([#261](https://github.com/plaid/plaid-ruby/pull/261))
|
79
|
+
|
80
|
+
# 8.6.0 20-Feb-2020
|
81
|
+
|
82
|
+
- Add support for transactions refresh product ([#258](https://github.com/plaid/plaid-ruby/pull/258))
|
83
|
+
- `/transactions/refresh`
|
84
|
+
|
85
|
+
# 8.5.0 10-Feb-2020
|
86
|
+
|
87
|
+
- Add support for deposit switch product ([#251](https://github.com/plaid/plaid-ruby/pull/251))
|
88
|
+
- Add support for generic processor token ([#256](https://github.com/plaid/plaid-ruby/pull/256))
|
89
|
+
- Add support for webhook verification ([#249](https://github.com/plaid/plaid-ruby/pull/249))
|
90
|
+
|
91
|
+
# 8.4.0 23-Jan-2020
|
92
|
+
|
93
|
+
- Add support for new UK Payment Initiation product ([#246](https://github.com/plaid/plaid-ruby/pull/246))
|
94
|
+
- `/payment_initiation/recipient/create`
|
95
|
+
- `/payment_initiation/recipient/get`
|
96
|
+
- `/payment_initiation/recipient/list`
|
97
|
+
- `/payment_initiation/payment/create`
|
98
|
+
- `/payment_initiation/payment/token/create`
|
99
|
+
- `/payment_initiation/payment/get`
|
100
|
+
- `/payment_initiation/payment/list`
|
101
|
+
- Add `consent_expiration_time` to the Item interface ([#247](https://github.com/plaid/plaid-ruby/pull/247))
|
102
|
+
|
103
|
+
# 8.3.0 17-Sep-2019
|
104
|
+
|
105
|
+
- Add support for new [Ocrolus Partnership](https://plaid.com/docs/ocrolus/)
|
106
|
+
|
107
|
+
# 8.2.0 16-Sep-2019
|
108
|
+
|
109
|
+
- Update Assets schema for international address support
|
110
|
+
|
1
111
|
# 8.1.0 23-Jul-2019
|
2
112
|
|
3
|
-
|
113
|
+
- Add binding for the new [liabilities product](https://plaid.com/docs/api/#liabilities)
|
4
114
|
|
5
115
|
# 8.0.0 19-Jun-2019
|
6
116
|
|
7
|
-
|
117
|
+
- Deprecate direct integration as it is no longer supported
|
8
118
|
|
9
119
|
# 7.1.0 17-Jun-2019
|
10
120
|
|
11
|
-
|
121
|
+
- Add bindings for the new [investments product](https://plaid.com/docs/api/#investments).
|
12
122
|
|
13
123
|
# 7.0.0 20-May-2019
|
14
124
|
|
15
|
-
|
125
|
+
- Add support for 2019-05-29 API version
|
16
126
|
|
17
127
|
# 6.3.1 20-Mar-2019
|
18
128
|
|
19
|
-
|
129
|
+
- Remove unnecessary log line
|
20
130
|
|
21
131
|
# 6.3.0 5-Mar-2019
|
22
132
|
|
23
|
-
|
24
|
-
|
25
|
-
|
133
|
+
- Add support for include_institution_data to /institutions/search endpoint.
|
134
|
+
- Add support for include_institution_data to /institutions/get endpoint.
|
135
|
+
- Add support for include_institution data to /institutions/get_by_id endpoint.
|
26
136
|
|
27
137
|
# 6.2.1 14-Feb-2019
|
28
138
|
|
29
|
-
|
139
|
+
- Fix error models to support assets-related errors.
|
30
140
|
|
31
141
|
# 6.2.0 28-Nov-2018
|
32
142
|
|
33
|
-
|
143
|
+
- Assets + Insights reports
|
34
144
|
|
35
145
|
# 6.1.0 20-Jun-2018
|
36
146
|
|
37
|
-
|
147
|
+
- Add bindings for the new [assets product](https://plaid.com/docs/api/#assets).
|
38
148
|
|
39
149
|
# 6.0.0 22-May-2018
|
40
150
|
|
41
|
-
|
42
|
-
|
43
|
-
|
151
|
+
- Use `Plaid-Version` header to request the certain compatible API version.
|
152
|
+
- Change Auth-related data structures to conform to the API.
|
153
|
+
- Include currency-related fields for transaction and account objects.
|
44
154
|
|
45
155
|
# 5.0.0 23-Mar-2018
|
46
156
|
|
47
|
-
|
157
|
+
- Introduce true response objects instead of deep nested hashes. Any of the
|
48
158
|
three syntaxes can be used interchangeably for any API response:
|
49
159
|
`response['foo']['bar']`, `response[:foo][:bar]`, or `response.foo.bar`.
|
50
|
-
|
160
|
+
- Add Dwolla and Apex products.
|
51
161
|
|
52
162
|
# 4.1.0 04-Jan-2018
|
53
163
|
|
54
|
-
|
55
|
-
|
56
|
-
|
164
|
+
- Make `/item/remove` the primary Item removal endpoint
|
165
|
+
- Add #options parameter to `/institutions/get`
|
166
|
+
- Handle network errors with `PlaidServerError`
|
57
167
|
|
58
168
|
# 4.0.0 09-Mar-2017
|
59
169
|
|
60
|
-
|
170
|
+
- 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).
|
61
171
|
|
62
172
|
# 3.0.0. 17-Jan-2017
|
63
173
|
|
64
|
-
|
174
|
+
- Add `/institutions/all` and `/institutions/all/search` endpoints, see [UPGRADING.md](UPGRADING.md#upgrading-from-2xx-to-300)
|
65
175
|
|
66
176
|
# 2.2.0. 03-Nov-2016
|
67
177
|
|
68
|
-
|
69
|
-
|
178
|
+
- Add `Transaction#reference_number` (@ericbirdsall).
|
179
|
+
- Fix webhook codes and add risk and income webhooks.
|
70
180
|
|
71
181
|
# 2.1.0. 19-Oct-2016
|
72
182
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
183
|
+
- Documentation fixes (@ishmael).
|
184
|
+
- Fix `Transaction#to_s` behavior (@michel-tricot).
|
185
|
+
- PATCH `/:product/step` flow.
|
186
|
+
- Use the same client in `User#upgrade` (@betesh).
|
187
|
+
- Webhook object (@zshannon).
|
188
|
+
- `processor_token` access in `User.exchange_token` (@gylaz).
|
189
|
+
- Raise `ServerError` in case server returned an empty response body.
|
80
190
|
|
81
191
|
# 2.0.0. 24-May-2016
|
82
192
|
|
83
|
-
|
84
|
-
|
193
|
+
- Use `~> 1.0` spec for multi_json dependency.
|
194
|
+
- Support `stripe_bank_account_token` in `User.exchange_token`.
|
85
195
|
|
86
196
|
# 2.0.0.alpha.2. 14-May-2016
|
87
197
|
|
88
|
-
|
198
|
+
- Use `:production` instead of `:api` to signify production environment
|
89
199
|
in `Plaid::Client#env=`.
|
90
|
-
|
91
|
-
|
200
|
+
- `User#mfa_step` allows to specify options now (thanks @gcweeks).
|
201
|
+
- Implemented `User#update_webhook`.
|
92
202
|
|
93
203
|
# 2.0.0.alpha. 06-May-2016
|
94
204
|
|
95
|
-
|
205
|
+
- 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
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
plaid (
|
4
|
+
plaid (13.1.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,5 +1,7 @@
|
|
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
|
+
: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
|
+
|
3
5
|
The official Ruby bindings for the [Plaid API](https://plaid.com/docs).
|
4
6
|
|
5
7
|
## Installation
|
@@ -26,7 +28,8 @@ Each major version of `plaid-ruby` targets a specific version of the Plaid API:
|
|
26
28
|
|
27
29
|
| API version | plaid-ruby release |
|
28
30
|
| ----------- | ------------------ |
|
29
|
-
| [`
|
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` |
|
30
33
|
| [`2018-05-22`][api-version-2018-05-22] | `6.x.x` |
|
31
34
|
| `2017-03-08` | `5.x.x` |
|
32
35
|
|
@@ -41,15 +44,14 @@ The RubyDoc for the gem is available [here](http://plaid.github.io/plaid-ruby/).
|
|
41
44
|
|
42
45
|
### Creating a Plaid client
|
43
46
|
|
44
|
-
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:
|
45
48
|
|
46
49
|
```ruby
|
47
50
|
require 'plaid'
|
48
51
|
|
49
52
|
client = Plaid::Client.new(env: :sandbox,
|
50
53
|
client_id: '***',
|
51
|
-
secret: '***'
|
52
|
-
public_key: '***')
|
54
|
+
secret: '***')
|
53
55
|
```
|
54
56
|
|
55
57
|
The `env` field is the environment which the client will be running in. Your choices for the `env` field include:
|
@@ -63,7 +65,7 @@ The `env` field is the environment which the client will be running in. Your cho
|
|
63
65
|
The gem uses Faraday to wrap HTTPS connections, which allows you to tune certain params:
|
64
66
|
|
65
67
|
```ruby
|
66
|
-
client = Plaid::Client.new(env: :sandbox, client_id: '***', secret: '***'
|
68
|
+
client = Plaid::Client.new(env: :sandbox, client_id: '***', secret: '***') do |builder|
|
67
69
|
Plaid::Client.build_default_connection(builder)
|
68
70
|
|
69
71
|
# Increase network timeout
|
@@ -73,6 +75,27 @@ end
|
|
73
75
|
|
74
76
|
## Examples
|
75
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
|
+
|
76
99
|
### Exchanging a Link public_token for a Plaid access_token
|
77
100
|
|
78
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)`
|
@@ -84,6 +107,7 @@ response = client.item.public_token.exchange(public_token)
|
|
84
107
|
access_token = response.access_token
|
85
108
|
```
|
86
109
|
|
110
|
+
|
87
111
|
### Deleting an item
|
88
112
|
|
89
113
|
```ruby
|
@@ -91,8 +115,7 @@ require 'plaid'
|
|
91
115
|
|
92
116
|
client = Plaid::Client.new(env: :sandbox,
|
93
117
|
client_id: '***',
|
94
|
-
secret: '***'
|
95
|
-
public_key: '***')
|
118
|
+
secret: '***')
|
96
119
|
|
97
120
|
exchange_token_response = client.item.public_token.exchange('[Plaid Link public_token]')
|
98
121
|
access_token = exchange_token_response.access_token
|
@@ -107,8 +130,7 @@ require 'plaid'
|
|
107
130
|
|
108
131
|
client = Plaid::Client.new(env: :sandbox,
|
109
132
|
client_id: '***',
|
110
|
-
secret: '***'
|
111
|
-
public_key: '***')
|
133
|
+
secret: '***')
|
112
134
|
|
113
135
|
exchange_token_response = client.item.public_token.exchange('[Plaid Link public_token]')
|
114
136
|
access_token = exchange_token_response.access_token
|
@@ -136,8 +158,7 @@ require 'plaid'
|
|
136
158
|
|
137
159
|
client = Plaid::Client.new(env: :sandbox,
|
138
160
|
client_id: '***',
|
139
|
-
secret: '***'
|
140
|
-
public_key: '***')
|
161
|
+
secret: '***')
|
141
162
|
|
142
163
|
exchange_token_response = client.item.public_token.exchange('[Plaid Link public_token]')
|
143
164
|
access_token = exchange_token_response.access_token
|
@@ -154,8 +175,7 @@ require 'plaid'
|
|
154
175
|
|
155
176
|
client = Plaid::Client.new(env: :sandbox,
|
156
177
|
client_id: '***',
|
157
|
-
secret: '***'
|
158
|
-
public_key: '***')
|
178
|
+
secret: '***')
|
159
179
|
|
160
180
|
exchange_token_response = client.item.public_token.exchange('[Plaid Link public_token]')
|
161
181
|
access_token = exchange_token_response.access_token
|
@@ -208,6 +228,8 @@ Any methods making API calls will result in an exception raised unless the respo
|
|
208
228
|
|
209
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.
|
210
230
|
|
231
|
+
`Plaid::InstitutionError` is returned when there are errors for the requested financial institution.
|
232
|
+
|
211
233
|
Read more about response codes and their meaning in the
|
212
234
|
[Plaid documentation](https://plaid.com/docs/api).
|
213
235
|
|
@@ -238,6 +260,7 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
238
260
|
If you're looking for a Ruby client that works with the legacy Plaid API, use the [`plaid-legacy` gem][2].
|
239
261
|
|
240
262
|
[2]: https://github.com/plaid/plaid-ruby-legacy
|
241
|
-
[version-changelog]: https://plaid.com/docs/api
|
242
|
-
[api-version-2018-05-22]: https://plaid.com/docs/api
|
243
|
-
[api-version-2019-05-29]: https://plaid.com/docs/api
|
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
|