plaid 10.0.0 → 13.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -1
- data/.github/workflows/add_to_project.yml +21 -0
- data/.rubocop.yml +2 -2
- data/CHANGELOG.md +39 -0
- data/CONTRIBUTING.md +3 -4
- data/Gemfile.lock +6 -2
- data/PUBLISH.md +2 -1
- data/README.md +35 -16
- data/Rakefile +1 -1
- data/lib/plaid.rb +1 -0
- data/lib/plaid/client.rb +6 -13
- data/lib/plaid/models.rb +68 -0
- data/lib/plaid/products/base_product.rb +0 -5
- data/lib/plaid/products/institutions.rb +15 -12
- data/lib/plaid/products/item.rb +4 -27
- data/lib/plaid/products/link_token.rb +74 -0
- data/lib/plaid/products/payment_initiation.rb +25 -6
- data/lib/plaid/products/sandbox.rb +19 -9
- data/lib/plaid/version.rb +2 -2
- data/plaid.gemspec +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e1b3a6dd1a43a81dec93cc841fa8272f94fd53e604d6f2826035c221ac0cd1e
|
4
|
+
data.tar.gz: 920032b3617aae75fecbe0e0288e0279ad99ca215103e4e5825322d198560e4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ed91a6d2994ea510d2830e2b002f839098328ef7ece3fe1ed84458e2554f1a5138f5e51b009c32b7367f691b16e3ed94ce0d33497e9adb8eb9d868d2fa278d9
|
7
|
+
data.tar.gz: c2cef50ce789faf7a22d97e0d381f07b3b029ad5406613b3df6bb41cd8402c4552fcf6b852146a8a0c7bf10eceed8460aadc722e292da4cab915ef1af4fd8df5
|
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,3 +1,42 @@
|
|
1
|
+
# 13.0.0
|
2
|
+
- Add support for providing a payment initiation schedule
|
3
|
+
- Add back the (now deprecated) `/item/public_token/create` endpoint
|
4
|
+
- Add back the (now deprecated) `/payment_initiation/payment/token/create` endpoint
|
5
|
+
|
6
|
+
BREAKING CHANGES:
|
7
|
+
|
8
|
+
- Update minimum required Ruby version to 2.4
|
9
|
+
|
10
|
+
# 12.0.0
|
11
|
+
|
12
|
+
- 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.
|
13
|
+
- the `/item/public_token/create` endpoint has been disabled in favor of the /link/token/create
|
14
|
+
endpoint
|
15
|
+
- The `/item/add_token/create endpoint` has been disabled in favor of the /link/token/create
|
16
|
+
- The `/payment_initiation/payment/token/create` endpoint has been disabled in favor of the /link/token/create
|
17
|
+
endpoint
|
18
|
+
- The `/item/remove` endpoint will no longer return a `removed` boolean.
|
19
|
+
- The `/institutions/get`, `/institutions/get_by_id`, and `/institutions/search` now require
|
20
|
+
`country_codes` to be passed in.
|
21
|
+
|
22
|
+
# 11.1.0
|
23
|
+
|
24
|
+
- Add support for Link Token get endpoint ([#301](https://github.com/plaid/plaid-ruby/pull/301))
|
25
|
+
- `link/token/get`
|
26
|
+
|
27
|
+
# 11.0.0
|
28
|
+
|
29
|
+
- Add `merchant_name` to `Transaction` (#294)
|
30
|
+
|
31
|
+
BREAKING CHANGES:
|
32
|
+
|
33
|
+
- Removes the public key as input to `Client`. The public key is no longer needed by the API. (#287)
|
34
|
+
- Add link/token/create support (#293)
|
35
|
+
|
36
|
+
# 10.1.0
|
37
|
+
|
38
|
+
- 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))
|
39
|
+
|
1
40
|
# 10.0.0
|
2
41
|
|
3
42
|
- Add support for optional user fields for `/item/add_token/create` endpoint ([278](https://github.com/plaid/plaid-ruby/pull/278))
|
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.0.0)
|
5
5
|
faraday
|
6
6
|
faraday_middleware
|
7
7
|
hashie (>= 3.4.3)
|
@@ -11,8 +11,11 @@ GEM
|
|
11
11
|
specs:
|
12
12
|
ast (2.4.0)
|
13
13
|
dotenv (2.4.0)
|
14
|
-
faraday (1.0
|
14
|
+
faraday (1.3.0)
|
15
|
+
faraday-net_http (~> 1.0)
|
15
16
|
multipart-post (>= 1.2, < 3)
|
17
|
+
ruby2_keywords
|
18
|
+
faraday-net_http (1.0.0)
|
16
19
|
faraday_middleware (1.0.0)
|
17
20
|
faraday (~> 1.0)
|
18
21
|
hashie (4.1.0)
|
@@ -35,6 +38,7 @@ GEM
|
|
35
38
|
ruby-progressbar (~> 1.7)
|
36
39
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
37
40
|
ruby-progressbar (1.9.0)
|
41
|
+
ruby2_keywords (0.0.2)
|
38
42
|
sdoc (1.0.0)
|
39
43
|
rdoc (>= 5.0)
|
40
44
|
unicode-display_width (1.3.2)
|
data/PUBLISH.md
CHANGED
@@ -7,12 +7,13 @@ Prepare release:
|
|
7
7
|
1. update `lib/plaid/version.rb`, and `CHANGELOG.md` files.
|
8
8
|
2. run `bundle` to bump the version in `Gemfile.lock`
|
9
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`
|
10
11
|
|
11
12
|
Publish:
|
12
13
|
|
13
14
|
1. `git checkout master` and `git pull` (makes sure your `HEAD` is up-to-date).
|
14
15
|
2. Check that tests are passing on latest `master` build and (optional) `bundle exec rake test` to run tests locally
|
15
|
-
3. `bundle exec rake release` (builds the gem, creates a tag, pushes the gem to RubyGems and tag to GitHub).
|
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)
|
16
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.)
|
17
18
|
|
18
19
|
[1]: https://rubygems.org/
|
data/README.md
CHANGED
@@ -26,7 +26,8 @@ Each major version of `plaid-ruby` targets a specific version of the Plaid API:
|
|
26
26
|
|
27
27
|
| API version | plaid-ruby release |
|
28
28
|
| ----------- | ------------------ |
|
29
|
-
| [`
|
29
|
+
| [`2020-09-14`][api-version-2020-09-14] (**latest**) | `12.x.x` |
|
30
|
+
| [`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
31
|
| [`2018-05-22`][api-version-2018-05-22] | `6.x.x` |
|
31
32
|
| `2017-03-08` | `5.x.x` |
|
32
33
|
|
@@ -41,15 +42,14 @@ The RubyDoc for the gem is available [here](http://plaid.github.io/plaid-ruby/).
|
|
41
42
|
|
42
43
|
### Creating a Plaid client
|
43
44
|
|
44
|
-
Create an instance of the client using the `client_id
|
45
|
+
Create an instance of the client using the `client_id` and `secret` from your Plaid dashboard along with your environment of choice:
|
45
46
|
|
46
47
|
```ruby
|
47
48
|
require 'plaid'
|
48
49
|
|
49
50
|
client = Plaid::Client.new(env: :sandbox,
|
50
51
|
client_id: '***',
|
51
|
-
secret: '***'
|
52
|
-
public_key: '***')
|
52
|
+
secret: '***')
|
53
53
|
```
|
54
54
|
|
55
55
|
The `env` field is the environment which the client will be running in. Your choices for the `env` field include:
|
@@ -63,7 +63,7 @@ The `env` field is the environment which the client will be running in. Your cho
|
|
63
63
|
The gem uses Faraday to wrap HTTPS connections, which allows you to tune certain params:
|
64
64
|
|
65
65
|
```ruby
|
66
|
-
client = Plaid::Client.new(env: :sandbox, client_id: '***', secret: '***'
|
66
|
+
client = Plaid::Client.new(env: :sandbox, client_id: '***', secret: '***') do |builder|
|
67
67
|
Plaid::Client.build_default_connection(builder)
|
68
68
|
|
69
69
|
# Increase network timeout
|
@@ -73,6 +73,27 @@ end
|
|
73
73
|
|
74
74
|
## Examples
|
75
75
|
|
76
|
+
### Create a new link_token
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
# Grab the client_user_id by searching for the current user in your database
|
80
|
+
user = User.find_by!(email: '***')
|
81
|
+
client_user_id = user.id
|
82
|
+
|
83
|
+
# Create the link_token with all of your configurations
|
84
|
+
link_token_response = client.link_token.create(
|
85
|
+
user: { client_user_id: client_user_id.to_s },
|
86
|
+
client_name: 'My app',
|
87
|
+
products: %w[auth transactions],
|
88
|
+
country_codes: ['US'],
|
89
|
+
language: 'en'
|
90
|
+
)
|
91
|
+
|
92
|
+
# Pass the result to your client-side app to initialize Link
|
93
|
+
# and retrieve a public_token
|
94
|
+
link_token = link_token_response.link_token
|
95
|
+
```
|
96
|
+
|
76
97
|
### Exchanging a Link public_token for a Plaid access_token
|
77
98
|
|
78
99
|
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 +105,7 @@ response = client.item.public_token.exchange(public_token)
|
|
84
105
|
access_token = response.access_token
|
85
106
|
```
|
86
107
|
|
108
|
+
|
87
109
|
### Deleting an item
|
88
110
|
|
89
111
|
```ruby
|
@@ -91,8 +113,7 @@ require 'plaid'
|
|
91
113
|
|
92
114
|
client = Plaid::Client.new(env: :sandbox,
|
93
115
|
client_id: '***',
|
94
|
-
secret: '***'
|
95
|
-
public_key: '***')
|
116
|
+
secret: '***')
|
96
117
|
|
97
118
|
exchange_token_response = client.item.public_token.exchange('[Plaid Link public_token]')
|
98
119
|
access_token = exchange_token_response.access_token
|
@@ -107,8 +128,7 @@ require 'plaid'
|
|
107
128
|
|
108
129
|
client = Plaid::Client.new(env: :sandbox,
|
109
130
|
client_id: '***',
|
110
|
-
secret: '***'
|
111
|
-
public_key: '***')
|
131
|
+
secret: '***')
|
112
132
|
|
113
133
|
exchange_token_response = client.item.public_token.exchange('[Plaid Link public_token]')
|
114
134
|
access_token = exchange_token_response.access_token
|
@@ -136,8 +156,7 @@ require 'plaid'
|
|
136
156
|
|
137
157
|
client = Plaid::Client.new(env: :sandbox,
|
138
158
|
client_id: '***',
|
139
|
-
secret: '***'
|
140
|
-
public_key: '***')
|
159
|
+
secret: '***')
|
141
160
|
|
142
161
|
exchange_token_response = client.item.public_token.exchange('[Plaid Link public_token]')
|
143
162
|
access_token = exchange_token_response.access_token
|
@@ -154,8 +173,7 @@ require 'plaid'
|
|
154
173
|
|
155
174
|
client = Plaid::Client.new(env: :sandbox,
|
156
175
|
client_id: '***',
|
157
|
-
secret: '***'
|
158
|
-
public_key: '***')
|
176
|
+
secret: '***')
|
159
177
|
|
160
178
|
exchange_token_response = client.item.public_token.exchange('[Plaid Link public_token]')
|
161
179
|
access_token = exchange_token_response.access_token
|
@@ -240,6 +258,7 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
240
258
|
If you're looking for a Ruby client that works with the legacy Plaid API, use the [`plaid-legacy` gem][2].
|
241
259
|
|
242
260
|
[2]: https://github.com/plaid/plaid-ruby-legacy
|
243
|
-
[version-changelog]: https://plaid.com/docs/api
|
244
|
-
[api-version-2018-05-22]: https://plaid.com/docs/api
|
245
|
-
[api-version-2019-05-29]: https://plaid.com/docs/api
|
261
|
+
[version-changelog]: https://plaid.com/docs/api/versioning/
|
262
|
+
[api-version-2018-05-22]: https://plaid.com/docs/api/versioning/#2018-05-22
|
263
|
+
[api-version-2019-05-29]: https://plaid.com/docs/api/versioning/#2019-05-29
|
264
|
+
[api-version-2020-09-14]: https://plaid.com/docs/api/versioning/#2020-09-14
|
data/Rakefile
CHANGED
@@ -54,7 +54,7 @@ end
|
|
54
54
|
|
55
55
|
desc 'Hide real credentials in VCR cassettes'
|
56
56
|
task :vcr_hide_credentials do
|
57
|
-
all_creds = %w[PLAID_RUBY_CLIENT_ID PLAID_RUBY_SECRET
|
57
|
+
all_creds = %w[PLAID_RUBY_CLIENT_ID PLAID_RUBY_SECRET]
|
58
58
|
|
59
59
|
all_creds.each do |cred|
|
60
60
|
raise "#{cred} is not set" unless ENV[cred]
|
data/lib/plaid.rb
CHANGED
@@ -21,6 +21,7 @@ require_relative 'plaid/products/sandbox'
|
|
21
21
|
require_relative 'plaid/products/transactions'
|
22
22
|
require_relative 'plaid/products/investments'
|
23
23
|
require_relative 'plaid/products/liabilities'
|
24
|
+
require_relative 'plaid/products/link_token'
|
24
25
|
require_relative 'plaid/products/payment_initiation'
|
25
26
|
require_relative 'plaid/products/webhooks'
|
26
27
|
require_relative 'plaid/client'
|
data/lib/plaid/client.rb
CHANGED
@@ -19,13 +19,11 @@ module Plaid
|
|
19
19
|
# env - The Symbol (:sandbox, :development, :production)
|
20
20
|
# client_id - The String Plaid account client ID to authenticate requests
|
21
21
|
# secret - The String Plaid account secret to authenticate requests
|
22
|
-
|
23
|
-
def initialize(env:, client_id:, secret:, public_key:, &block)
|
22
|
+
def initialize(env:, client_id:, secret:, &block)
|
24
23
|
@env = env.to_sym
|
25
24
|
@api_host = api_host
|
26
25
|
@client_id = client_id
|
27
26
|
@secret = secret
|
28
|
-
@public_key = public_key
|
29
27
|
|
30
28
|
create_connection(&block)
|
31
29
|
end
|
@@ -117,6 +115,11 @@ module Plaid
|
|
117
115
|
# Public: The Plaid::Webhooks endpoint accessor.
|
118
116
|
subproduct :webhooks
|
119
117
|
|
118
|
+
##
|
119
|
+
## :attr_reader:
|
120
|
+
## Public: The Plaid::LinkToken endpoint accessor.
|
121
|
+
subproduct :link_token
|
122
|
+
|
120
123
|
# Public: Make a post request
|
121
124
|
#
|
122
125
|
# path - Path or URL to make the request to
|
@@ -140,16 +143,6 @@ module Plaid
|
|
140
143
|
).body
|
141
144
|
end
|
142
145
|
|
143
|
-
# Public: Make a post request with appended public key field.
|
144
|
-
#
|
145
|
-
# path - Path or URL to make the request to.
|
146
|
-
# payload - The payload or data to post.
|
147
|
-
#
|
148
|
-
# Returns the resulting parsed JSON of the request.
|
149
|
-
def post_with_public_key(path, payload)
|
150
|
-
@connection.post(path, payload.merge(public_key: @public_key)).body
|
151
|
-
end
|
152
|
-
|
153
146
|
# Public: Set Plaid defaults on the Faraday connection.
|
154
147
|
#
|
155
148
|
# builder - The Faraday builder object.
|
data/lib/plaid/models.rb
CHANGED
@@ -976,6 +976,12 @@ module Plaid
|
|
976
976
|
# Public: The location where transaction occurred (TransactionLocation).
|
977
977
|
property :location, coerce: TransactionLocation
|
978
978
|
|
979
|
+
##
|
980
|
+
# :attr_reader:
|
981
|
+
# Public: The String merchant name (or nil).
|
982
|
+
# E.g. "Burger King".
|
983
|
+
property :merchant_name
|
984
|
+
|
979
985
|
##
|
980
986
|
# :attr_reader:
|
981
987
|
# Public: The String transaction name (or nil).
|
@@ -1918,6 +1924,25 @@ module Plaid
|
|
1918
1924
|
property :value
|
1919
1925
|
end
|
1920
1926
|
|
1927
|
+
# Public: A representation of a payment amount.
|
1928
|
+
class PaymentSchedule < BaseModel
|
1929
|
+
##
|
1930
|
+
# :attr_reader:
|
1931
|
+
# Public: Interval for the standing order.
|
1932
|
+
property :interval
|
1933
|
+
|
1934
|
+
##
|
1935
|
+
# :attr_reader:
|
1936
|
+
# Public: Day or the week or day of the month to execute
|
1937
|
+
# the standing order.
|
1938
|
+
property :interval_execution_day
|
1939
|
+
|
1940
|
+
##
|
1941
|
+
# :attr_reader:
|
1942
|
+
# Public: Start date for the standing order.
|
1943
|
+
property :start_date
|
1944
|
+
end
|
1945
|
+
|
1921
1946
|
# Public: A representation of a payment amount.
|
1922
1947
|
class PaymentRecipientAddress < BaseModel
|
1923
1948
|
##
|
@@ -2004,6 +2029,11 @@ module Plaid
|
|
2004
2029
|
# Public: The payment amount.
|
2005
2030
|
property :amount, coerce: PaymentAmount
|
2006
2031
|
|
2032
|
+
##
|
2033
|
+
# :attr_reader:
|
2034
|
+
# Public: The payment schedule.
|
2035
|
+
property :schedule, coerce: PaymentSchedule
|
2036
|
+
|
2007
2037
|
##
|
2008
2038
|
# :attr_reader:
|
2009
2039
|
# Public: The payment's status.
|
@@ -2025,6 +2055,44 @@ module Plaid
|
|
2025
2055
|
property :recipient_id
|
2026
2056
|
end
|
2027
2057
|
|
2058
|
+
# Public: Metadata associated with a link token.
|
2059
|
+
class LinkTokenMetadata < BaseModel
|
2060
|
+
##
|
2061
|
+
# :attr_reader:
|
2062
|
+
# Public: List of products associated with the link token.
|
2063
|
+
property :initial_products
|
2064
|
+
|
2065
|
+
##
|
2066
|
+
# :attr_reader:
|
2067
|
+
# Public: The webhook associated with the link token.
|
2068
|
+
property :webhook
|
2069
|
+
|
2070
|
+
##
|
2071
|
+
# :attr_reader:
|
2072
|
+
# Public: The country codes associated with the link token.
|
2073
|
+
property :country_codes
|
2074
|
+
|
2075
|
+
##
|
2076
|
+
# :attr_reader:
|
2077
|
+
# Public: The language associated with the link token.
|
2078
|
+
property :language
|
2079
|
+
|
2080
|
+
##
|
2081
|
+
# :attr_reader:
|
2082
|
+
# Public: The account filters associated with the link token.
|
2083
|
+
property :account_filters
|
2084
|
+
|
2085
|
+
##
|
2086
|
+
# :attr_reader:
|
2087
|
+
# Public: The redirect URI associated with the link token.
|
2088
|
+
property :redirect_uri
|
2089
|
+
|
2090
|
+
##
|
2091
|
+
# :attr_reader:
|
2092
|
+
# Public: The client name associated with the link token.
|
2093
|
+
property :client_name
|
2094
|
+
end
|
2095
|
+
|
2028
2096
|
# Public: A representation of a payment amount.
|
2029
2097
|
class WebhookVerificationKey < BaseModel
|
2030
2098
|
##
|
@@ -60,10 +60,5 @@ module Plaid
|
|
60
60
|
def post_with_auth(path, response_class, payload)
|
61
61
|
response_class.new(client.post_with_auth(path, payload))
|
62
62
|
end
|
63
|
-
|
64
|
-
# Internal: Do a POST to API and capture it into a response object.
|
65
|
-
def post_with_public_key(path, response_class, payload)
|
66
|
-
response_class.new(client.post_with_public_key(path, payload))
|
67
|
-
end
|
68
63
|
end
|
69
64
|
end
|
@@ -11,9 +11,10 @@ module Plaid
|
|
11
11
|
# options - Options for filtering institutions.
|
12
12
|
#
|
13
13
|
# Returns a MultipleInstitutionsResponse instance.
|
14
|
-
def get(count:, offset:, options: nil)
|
14
|
+
def get(count:, offset:, country_codes:, options: nil)
|
15
15
|
payload = { count: count,
|
16
|
-
offset: offset
|
16
|
+
offset: offset,
|
17
|
+
country_codes: country_codes }
|
17
18
|
payload[:options] = options unless options.nil?
|
18
19
|
|
19
20
|
post_with_auth 'institutions/get',
|
@@ -30,14 +31,15 @@ module Plaid
|
|
30
31
|
# options - Options for filtering institutions.
|
31
32
|
#
|
32
33
|
# Returns a SingleInstitutionResponse instance.
|
33
|
-
def get_by_id(institution_id, options: nil)
|
34
|
+
def get_by_id(institution_id, country_codes, options: nil)
|
34
35
|
payload = {
|
35
|
-
institution_id: institution_id
|
36
|
+
institution_id: institution_id,
|
37
|
+
country_codes: country_codes
|
36
38
|
}
|
37
39
|
payload[:options] = options unless options.nil?
|
38
|
-
|
39
|
-
|
40
|
-
|
40
|
+
post_with_auth 'institutions/get_by_id',
|
41
|
+
SingleInstitutionResponse,
|
42
|
+
payload
|
41
43
|
end
|
42
44
|
|
43
45
|
# Public: Get information about all available institutions matching your
|
@@ -51,17 +53,18 @@ module Plaid
|
|
51
53
|
# options - Options for filtering institutions.
|
52
54
|
#
|
53
55
|
# Returns a MultipleInstitutionsResponse instance.
|
54
|
-
def search(query, products = nil, options: nil)
|
56
|
+
def search(query, country_codes, products = nil, options: nil)
|
55
57
|
payload = {
|
56
58
|
query: query,
|
57
|
-
products: products
|
59
|
+
products: products,
|
60
|
+
country_codes: country_codes
|
58
61
|
}
|
59
62
|
|
60
63
|
payload[:options] = options unless options.nil?
|
61
64
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
+
post_with_auth 'institutions/search',
|
66
|
+
MultipleInstitutionsResponse,
|
67
|
+
payload
|
65
68
|
end
|
66
69
|
end
|
67
70
|
|
data/lib/plaid/products/item.rb
CHANGED
@@ -25,28 +25,6 @@ module Plaid
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
# Public: Class used to call the AddToken sub-product.
|
29
|
-
class AddToken < BaseProduct
|
30
|
-
def create(user)
|
31
|
-
post_with_auth 'item/add_token/create',
|
32
|
-
CreateResponse,
|
33
|
-
user: user
|
34
|
-
end
|
35
|
-
|
36
|
-
# Public: Response for /item/add_token/create.
|
37
|
-
class CreateResponse < Models::BaseResponse
|
38
|
-
##
|
39
|
-
# :attr_reader:
|
40
|
-
# Public: The String token.
|
41
|
-
property :add_token
|
42
|
-
|
43
|
-
##
|
44
|
-
# :attr_reader:
|
45
|
-
# Public: The String token expiration time.
|
46
|
-
property :expiration
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
28
|
# Public: Class used to call the PublicToken sub-product
|
51
29
|
class PublicToken < BaseProduct
|
52
30
|
# Public: Creates a public token from an access_token.
|
@@ -58,6 +36,10 @@ module Plaid
|
|
58
36
|
#
|
59
37
|
# Returns a CreateResponse object with a public token and expiration info.
|
60
38
|
def create(access_token)
|
39
|
+
puts 'Warning: this method will be deprecated in a future version. '\
|
40
|
+
'To replace the public_token for initializing Link, look into '\
|
41
|
+
'the link_token at https://plaid.com/docs/api/tokens/#linktokencreate.'
|
42
|
+
|
61
43
|
post_with_auth 'item/public_token/create',
|
62
44
|
CreateResponse,
|
63
45
|
access_token: access_token
|
@@ -146,11 +128,6 @@ module Plaid
|
|
146
128
|
# Public: The Plaid::PublicToken product accessor.
|
147
129
|
subproduct :public_token
|
148
130
|
|
149
|
-
##
|
150
|
-
# :attr_reader:
|
151
|
-
# Public: The Plaid::AddToken product accessor.
|
152
|
-
subproduct :add_token
|
153
|
-
|
154
131
|
##
|
155
132
|
# :attr_reader:
|
156
133
|
# Public: The Plaid::Webhook product accessor.
|
@@ -0,0 +1,74 @@
|
|
1
|
+
LINK_TOKEN_FIELD_NAMES = %i[
|
2
|
+
user
|
3
|
+
client_name
|
4
|
+
products
|
5
|
+
country_codes
|
6
|
+
language
|
7
|
+
webhook
|
8
|
+
access_token
|
9
|
+
link_customization_name
|
10
|
+
redirect_uri
|
11
|
+
android_package_name
|
12
|
+
account_filters
|
13
|
+
cross_app_item_add
|
14
|
+
payment_initiation
|
15
|
+
].freeze
|
16
|
+
|
17
|
+
module Plaid
|
18
|
+
# Public: Class used to call the LinkToken sub-product.
|
19
|
+
class LinkToken < BaseProduct
|
20
|
+
def create(configs)
|
21
|
+
body = {}
|
22
|
+
|
23
|
+
LINK_TOKEN_FIELD_NAMES.each do |field|
|
24
|
+
body[field] = configs[field]
|
25
|
+
end
|
26
|
+
|
27
|
+
post_with_auth 'link/token/create',
|
28
|
+
CreateResponse,
|
29
|
+
body
|
30
|
+
end
|
31
|
+
|
32
|
+
def get(link_token)
|
33
|
+
post_with_auth 'link/token/get',
|
34
|
+
GetResponse,
|
35
|
+
link_token: link_token
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Public: Response for /link/token/create.
|
40
|
+
class CreateResponse < Models::BaseResponse
|
41
|
+
##
|
42
|
+
# :attr_reader:
|
43
|
+
# Public: The String token.
|
44
|
+
property :link_token
|
45
|
+
|
46
|
+
##
|
47
|
+
# :attr_reader:
|
48
|
+
# Public: The String token expiration time.
|
49
|
+
property :expiration
|
50
|
+
end
|
51
|
+
|
52
|
+
# Public: Response for /link/token/get.
|
53
|
+
class GetResponse < Models::BaseResponse
|
54
|
+
##
|
55
|
+
# :attr_reader:
|
56
|
+
# Public: The String token.
|
57
|
+
property :link_token
|
58
|
+
|
59
|
+
##
|
60
|
+
# :attr_reader:
|
61
|
+
# Public: The link token expiration time.
|
62
|
+
property :expiration
|
63
|
+
|
64
|
+
##
|
65
|
+
# :attr_reader:
|
66
|
+
# Public: The link token created time.
|
67
|
+
property :created_at
|
68
|
+
|
69
|
+
##
|
70
|
+
# :attr_reader:
|
71
|
+
# Public: The metadata associated with the link token.
|
72
|
+
property :metadata, coerce: Models::LinkTokenMetadata
|
73
|
+
end
|
74
|
+
end
|
@@ -43,14 +43,24 @@ module Plaid
|
|
43
43
|
# recipient_id - Recipient ID that the payment will be initiated for.
|
44
44
|
# reference - Payment reference.
|
45
45
|
# amount - Payment amount.
|
46
|
+
# schedule - Payment schedule.
|
46
47
|
#
|
47
48
|
# Returns a PaymentCreateResponse object.
|
48
|
-
def create_payment(recipient_id, reference, amount)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
def create_payment(recipient_id, reference, amount, schedule: nil)
|
50
|
+
if schedule.nil?
|
51
|
+
post_with_auth 'payment_initiation/payment/create',
|
52
|
+
PaymentCreateResponse,
|
53
|
+
recipient_id: recipient_id,
|
54
|
+
reference: reference,
|
55
|
+
amount: amount
|
56
|
+
else
|
57
|
+
post_with_auth 'payment_initiation/payment/create',
|
58
|
+
PaymentCreateResponse,
|
59
|
+
recipient_id: recipient_id,
|
60
|
+
reference: reference,
|
61
|
+
amount: amount,
|
62
|
+
schedule: schedule
|
63
|
+
end
|
54
64
|
end
|
55
65
|
|
56
66
|
# Public: Create a payment token.
|
@@ -59,6 +69,10 @@ module Plaid
|
|
59
69
|
#
|
60
70
|
# Returns a PaymentTokenCreateResponse object.
|
61
71
|
def create_payment_token(payment_id)
|
72
|
+
puts 'Warning: this method will be deprecated in a future version. '\
|
73
|
+
'To replace the payment_token, look into the link_token at '\
|
74
|
+
'https://plaid.com/docs/api/tokens/#linktokencreate.'
|
75
|
+
|
62
76
|
post_with_auth 'payment_initiation/payment/token/create',
|
63
77
|
PaymentTokenCreateResponse,
|
64
78
|
payment_id: payment_id
|
@@ -181,6 +195,11 @@ module Plaid
|
|
181
195
|
# Public: The payment amount.
|
182
196
|
property :amount, coerce: Models::PaymentAmount
|
183
197
|
|
198
|
+
##
|
199
|
+
# :attr_reader:
|
200
|
+
# Public: The payment schedule.
|
201
|
+
property :schedule, coerce: Models::PaymentSchedule
|
202
|
+
|
184
203
|
##
|
185
204
|
# :attr_reader:
|
186
205
|
# Public: The payment's status.
|
@@ -72,10 +72,12 @@ module Plaid
|
|
72
72
|
# to generate a public_token given an institution and list of
|
73
73
|
# products.
|
74
74
|
#
|
75
|
-
# institution_id
|
76
|
-
# initial_products
|
77
|
-
# webhook
|
78
|
-
#
|
75
|
+
# institution_id - Specific institution id to generate token for.
|
76
|
+
# initial_products - Products for which generated token is valid for.
|
77
|
+
# webhook - webhook to associate with the item (optional).
|
78
|
+
# override_username - Specific test credential username to use
|
79
|
+
# override_password - Specific test credential password to use
|
80
|
+
# options - Additional options to merge into API request.
|
79
81
|
#
|
80
82
|
# Returns a SandboxCreateResponse object with a public token and item id.
|
81
83
|
def create(institution_id:,
|
@@ -83,6 +85,8 @@ module Plaid
|
|
83
85
|
transactions_start_date: nil,
|
84
86
|
transactions_end_date: nil,
|
85
87
|
webhook: nil,
|
88
|
+
override_username: nil,
|
89
|
+
override_password: nil,
|
86
90
|
options: nil)
|
87
91
|
|
88
92
|
options_payload = {}
|
@@ -90,13 +94,19 @@ module Plaid
|
|
90
94
|
txn_options = transaction_options transactions_start_date,
|
91
95
|
transactions_end_date
|
92
96
|
options_payload[:transactions] = txn_options if txn_options != {}
|
97
|
+
unless override_username.nil?
|
98
|
+
options_payload[:override_username] = override_username
|
99
|
+
end
|
100
|
+
unless override_password.nil?
|
101
|
+
options_payload[:override_password] = override_password
|
102
|
+
end
|
93
103
|
options_payload = options_payload.merge(options) unless options.nil?
|
94
104
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
105
|
+
post_with_auth 'sandbox/public_token/create',
|
106
|
+
SandboxCreateResponse,
|
107
|
+
institution_id: institution_id,
|
108
|
+
initial_products: initial_products,
|
109
|
+
options: options_payload
|
100
110
|
end
|
101
111
|
|
102
112
|
private def transaction_options(start_date, end_date)
|
data/lib/plaid/version.rb
CHANGED
data/plaid.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
|
|
32
32
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
33
33
|
spec.require_paths = ['lib']
|
34
34
|
|
35
|
-
spec.required_ruby_version = '>= 2.
|
35
|
+
spec.required_ruby_version = '>= 2.4.0'
|
36
36
|
|
37
37
|
spec.add_dependency 'faraday'
|
38
38
|
spec.add_dependency 'faraday_middleware'
|
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:
|
4
|
+
version: 13.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edmund Loo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -174,6 +174,7 @@ extra_rdoc_files: []
|
|
174
174
|
files:
|
175
175
|
- ".circleci/config.yml"
|
176
176
|
- ".env.sample"
|
177
|
+
- ".github/workflows/add_to_project.yml"
|
177
178
|
- ".rubocop.yml"
|
178
179
|
- CHANGELOG.md
|
179
180
|
- CONTRIBUTING.md
|
@@ -204,6 +205,7 @@ files:
|
|
204
205
|
- lib/plaid/products/investments.rb
|
205
206
|
- lib/plaid/products/item.rb
|
206
207
|
- lib/plaid/products/liabilities.rb
|
208
|
+
- lib/plaid/products/link_token.rb
|
207
209
|
- lib/plaid/products/payment_initiation.rb
|
208
210
|
- lib/plaid/products/processor.rb
|
209
211
|
- lib/plaid/products/sandbox.rb
|
@@ -224,14 +226,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
224
226
|
requirements:
|
225
227
|
- - ">="
|
226
228
|
- !ruby/object:Gem::Version
|
227
|
-
version: 2.
|
229
|
+
version: 2.4.0
|
228
230
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
229
231
|
requirements:
|
230
232
|
- - ">="
|
231
233
|
- !ruby/object:Gem::Version
|
232
234
|
version: '0'
|
233
235
|
requirements: []
|
234
|
-
rubygems_version: 3.
|
236
|
+
rubygems_version: 3.0.3
|
235
237
|
signing_key:
|
236
238
|
specification_version: 4
|
237
239
|
summary: Ruby bindings for Plaid
|