plaid 10.1.0 → 13.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67b2fb1563bb0f5dc21d092bd5ae83e043f7cd1f48728dc47eb094325dbf340d
4
- data.tar.gz: '09ed65928719206c075b22ccb8dbba5929b2c309bca6f329071dac1a24b4db29'
3
+ metadata.gz: 889bbda3066333276dde988cc70df8d2b858685b9afa425ff18505073836b3a8
4
+ data.tar.gz: 563c58e930b00fa84d2ef79945139ce8267730433549964953cf26984ee30219
5
5
  SHA512:
6
- metadata.gz: ede7755a232da3df4d8a464d77ccaa828ffba99e14d6677f0f85edcf21445475bf894a7dc7cbffccca38d9aed6fd3ee75f5591807460b05507213acc2c96cc8b
7
- data.tar.gz: fc9cd109f8d7ee3fb75c323f10ea726e6cedd76000f260cbdce26b362e069eb1979cd3de853f5c6158e35f0e04546347620f0144a21e7331e0d90f4d1b7c4364
6
+ metadata.gz: 47a70ded60dc17d5517f9df0699a66b61aac31f0d02110b0123d7eb4b11e9129aa2f3033eba6fb4a04ac37740f7f2bd4618e45092ab4762f7b9c9c64890718ab
7
+ data.tar.gz: 9864f80769148aa5a2ebce0d488bf1518d8e0ec7868daf31084ba53b97e376ea337f1817afe558f7a1863e60e1acd079846423983dd9a5db1f4f07104308103c
data/.circleci/config.yml CHANGED
@@ -2,7 +2,7 @@ version: 2
2
2
  jobs:
3
3
  build:
4
4
  docker:
5
- - image: circleci/ruby:2.3
5
+ - image: circleci/ruby:2.4
6
6
  steps:
7
7
  - checkout
8
8
  - run:
@@ -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.1
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
- Max: 20
11
+ Enabled: false
12
12
 
13
13
  Metrics/MethodLength:
14
14
  Max: 20
data/CHANGELOG.md CHANGED
@@ -1,3 +1,41 @@
1
+ # 13.0.1
2
+ - Add `update_type` to `Item` model.
3
+
4
+ # 13.0.0
5
+ - Add support for providing a payment initiation schedule
6
+ - Add back the (now deprecated) `/item/public_token/create` endpoint
7
+ - Add back the (now deprecated) `/payment_initiation/payment/token/create` endpoint
8
+
9
+ BREAKING CHANGES:
10
+
11
+ - Update minimum required Ruby version to 2.4
12
+
13
+ # 12.0.0
14
+
15
+ - 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.
16
+ - the `/item/public_token/create` endpoint has been disabled in favor of the /link/token/create
17
+ endpoint
18
+ - The `/item/add_token/create endpoint` has been disabled in favor of the /link/token/create
19
+ - The `/payment_initiation/payment/token/create` endpoint has been disabled in favor of the /link/token/create
20
+ endpoint
21
+ - The `/item/remove` endpoint will no longer return a `removed` boolean.
22
+ - The `/institutions/get`, `/institutions/get_by_id`, and `/institutions/search` now require
23
+ `country_codes` to be passed in.
24
+
25
+ # 11.1.0
26
+
27
+ - Add support for Link Token get endpoint ([#301](https://github.com/plaid/plaid-ruby/pull/301))
28
+ - `link/token/get`
29
+
30
+ # 11.0.0
31
+
32
+ - Add `merchant_name` to `Transaction` (#294)
33
+
34
+ BREAKING CHANGES:
35
+
36
+ - Removes the public key as input to `Client`. The public key is no longer needed by the API. (#287)
37
+ - Add link/token/create support (#293)
38
+
1
39
  # 10.1.0
2
40
 
3
41
  - 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))
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`, `secret`,
12
- and `public_key` from your Plaid dashboard. Create a file named `.env`
13
- based on `.env.sample` which is provided:
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 (10.1.0)
4
+ plaid (13.0.1)
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.1)
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.1)
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.4)
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
@@ -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: This major version of the library will only receive critical security patches after 7/12/21. 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
- | [`2019-05-29`][api-version-2019-05-29] (**latest**) | `9.x.x`, `8.x.x`, `7.x.x` |
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`, `secret`, and `public_key` from your Plaid dashboard along with your environment of choice:
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: '***', public_key: '***') do |builder|
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
@@ -240,6 +260,7 @@ The gem is available as open source under the terms of the [MIT License](http://
240
260
  If you're looking for a Ruby client that works with the legacy Plaid API, use the [`plaid-legacy` gem][2].
241
261
 
242
262
  [2]: https://github.com/plaid/plaid-ruby-legacy
243
- [version-changelog]: https://plaid.com/docs/api-upgrades
244
- [api-version-2018-05-22]: https://plaid.com/docs/api-upgrades#2018-05-22
245
- [api-version-2019-05-29]: https://plaid.com/docs/api-upgrades#2019-05-29
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
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 PLAID_RUBY_PUBLIC_KEY]
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
- # public_key - The String Plaid account public key to authenticate requests
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
@@ -123,6 +123,11 @@ module Plaid
123
123
  # Public: The String item ID.
124
124
  property :item_id
125
125
 
126
+ ##
127
+ # :attr_reader:
128
+ # Public: The String update type.
129
+ property :update_type
130
+
126
131
  ##
127
132
  # :attr_reader:
128
133
  # Public: The String webhook URL.
@@ -133,6 +138,11 @@ module Plaid
133
138
  # Public: The String consent expiration timestamp (or nil)
134
139
  # (e.g. "2019-04-22T00:00:00Z").
135
140
  property :consent_expiration_time
141
+
142
+ ##
143
+ # :attr_reader:
144
+ # Public: The String update type.
145
+ property :update_type
136
146
  end
137
147
 
138
148
  # Public: A representation of Item webhook status
@@ -976,6 +986,12 @@ module Plaid
976
986
  # Public: The location where transaction occurred (TransactionLocation).
977
987
  property :location, coerce: TransactionLocation
978
988
 
989
+ ##
990
+ # :attr_reader:
991
+ # Public: The String merchant name (or nil).
992
+ # E.g. "Burger King".
993
+ property :merchant_name
994
+
979
995
  ##
980
996
  # :attr_reader:
981
997
  # Public: The String transaction name (or nil).
@@ -1918,6 +1934,25 @@ module Plaid
1918
1934
  property :value
1919
1935
  end
1920
1936
 
1937
+ # Public: A representation of a payment amount.
1938
+ class PaymentSchedule < BaseModel
1939
+ ##
1940
+ # :attr_reader:
1941
+ # Public: Interval for the standing order.
1942
+ property :interval
1943
+
1944
+ ##
1945
+ # :attr_reader:
1946
+ # Public: Day or the week or day of the month to execute
1947
+ # the standing order.
1948
+ property :interval_execution_day
1949
+
1950
+ ##
1951
+ # :attr_reader:
1952
+ # Public: Start date for the standing order.
1953
+ property :start_date
1954
+ end
1955
+
1921
1956
  # Public: A representation of a payment amount.
1922
1957
  class PaymentRecipientAddress < BaseModel
1923
1958
  ##
@@ -2004,6 +2039,11 @@ module Plaid
2004
2039
  # Public: The payment amount.
2005
2040
  property :amount, coerce: PaymentAmount
2006
2041
 
2042
+ ##
2043
+ # :attr_reader:
2044
+ # Public: The payment schedule.
2045
+ property :schedule, coerce: PaymentSchedule
2046
+
2007
2047
  ##
2008
2048
  # :attr_reader:
2009
2049
  # Public: The payment's status.
@@ -2025,6 +2065,44 @@ module Plaid
2025
2065
  property :recipient_id
2026
2066
  end
2027
2067
 
2068
+ # Public: Metadata associated with a link token.
2069
+ class LinkTokenMetadata < BaseModel
2070
+ ##
2071
+ # :attr_reader:
2072
+ # Public: List of products associated with the link token.
2073
+ property :initial_products
2074
+
2075
+ ##
2076
+ # :attr_reader:
2077
+ # Public: The webhook associated with the link token.
2078
+ property :webhook
2079
+
2080
+ ##
2081
+ # :attr_reader:
2082
+ # Public: The country codes associated with the link token.
2083
+ property :country_codes
2084
+
2085
+ ##
2086
+ # :attr_reader:
2087
+ # Public: The language associated with the link token.
2088
+ property :language
2089
+
2090
+ ##
2091
+ # :attr_reader:
2092
+ # Public: The account filters associated with the link token.
2093
+ property :account_filters
2094
+
2095
+ ##
2096
+ # :attr_reader:
2097
+ # Public: The redirect URI associated with the link token.
2098
+ property :redirect_uri
2099
+
2100
+ ##
2101
+ # :attr_reader:
2102
+ # Public: The client name associated with the link token.
2103
+ property :client_name
2104
+ end
2105
+
2028
2106
  # Public: A representation of a payment amount.
2029
2107
  class WebhookVerificationKey < BaseModel
2030
2108
  ##
@@ -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
- post_with_public_key 'institutions/get_by_id',
39
- SingleInstitutionResponse,
40
- payload
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
- post_with_public_key 'institutions/search',
63
- MultipleInstitutionsResponse,
64
- payload
65
+ post_with_auth 'institutions/search',
66
+ MultipleInstitutionsResponse,
67
+ payload
65
68
  end
66
69
  end
67
70
 
@@ -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
@@ -4,9 +4,11 @@ module Plaid
4
4
  # Public: Create a recipient.
5
5
  #
6
6
  # name - Recipient name.
7
- # iban - Recipient IBAN.
8
- # address - Recipient address.
9
- # bacs - Recipient BACS (hash with "account" and "sort_code" keys)
7
+ # iban - Recipient IBAN. Should be nil if using bacs.
8
+ # address - Recipient address (hash with "street", "city", "postal_code"
9
+ # and "country"). Best practice is to set it as nil.
10
+ # bacs - Recipient BACS (hash with "account" and "sort_code" keys).
11
+ # Should be nil if using iban.
10
12
  #
11
13
  # Returns a PaymentRecipientCreateResponse object.
12
14
  def create_recipient(name, iban, address, bacs)
@@ -43,14 +45,24 @@ module Plaid
43
45
  # recipient_id - Recipient ID that the payment will be initiated for.
44
46
  # reference - Payment reference.
45
47
  # amount - Payment amount.
48
+ # schedule - Payment schedule.
46
49
  #
47
50
  # Returns a PaymentCreateResponse object.
48
- def create_payment(recipient_id, reference, amount)
49
- post_with_auth 'payment_initiation/payment/create',
50
- PaymentCreateResponse,
51
- recipient_id: recipient_id,
52
- reference: reference,
53
- amount: amount
51
+ def create_payment(recipient_id, reference, amount, schedule: nil)
52
+ if schedule.nil?
53
+ post_with_auth 'payment_initiation/payment/create',
54
+ PaymentCreateResponse,
55
+ recipient_id: recipient_id,
56
+ reference: reference,
57
+ amount: amount
58
+ else
59
+ post_with_auth 'payment_initiation/payment/create',
60
+ PaymentCreateResponse,
61
+ recipient_id: recipient_id,
62
+ reference: reference,
63
+ amount: amount,
64
+ schedule: schedule
65
+ end
54
66
  end
55
67
 
56
68
  # Public: Create a payment token.
@@ -59,6 +71,10 @@ module Plaid
59
71
  #
60
72
  # Returns a PaymentTokenCreateResponse object.
61
73
  def create_payment_token(payment_id)
74
+ puts 'Warning: this method will be deprecated in a future version. '\
75
+ 'To replace the payment_token, look into the link_token at '\
76
+ 'https://plaid.com/docs/api/tokens/#linktokencreate.'
77
+
62
78
  post_with_auth 'payment_initiation/payment/token/create',
63
79
  PaymentTokenCreateResponse,
64
80
  payment_id: payment_id
@@ -181,6 +197,11 @@ module Plaid
181
197
  # Public: The payment amount.
182
198
  property :amount, coerce: Models::PaymentAmount
183
199
 
200
+ ##
201
+ # :attr_reader:
202
+ # Public: The payment schedule.
203
+ property :schedule, coerce: Models::PaymentSchedule
204
+
184
205
  ##
185
206
  # :attr_reader:
186
207
  # Public: The payment's status.
@@ -102,11 +102,11 @@ module Plaid
102
102
  end
103
103
  options_payload = options_payload.merge(options) unless options.nil?
104
104
 
105
- post_with_public_key 'sandbox/public_token/create',
106
- SandboxCreateResponse,
107
- institution_id: institution_id,
108
- initial_products: initial_products,
109
- options: options_payload
105
+ post_with_auth 'sandbox/public_token/create',
106
+ SandboxCreateResponse,
107
+ institution_id: institution_id,
108
+ initial_products: initial_products,
109
+ options: options_payload
110
110
  end
111
111
 
112
112
  private def transaction_options(start_date, end_date)
data/lib/plaid/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Plaid
2
- VERSION = '10.1.0'.freeze
3
- API_VERSION = '2019-05-29'.freeze
2
+ VERSION = '13.0.1'.freeze
3
+ API_VERSION = '2020-09-14'.freeze
4
4
  end
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.1.0'
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: 10.1.0
4
+ version: 13.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edmund Loo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-27 00:00:00.000000000 Z
11
+ date: 2021-03-04 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,7 +226,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
224
226
  requirements:
225
227
  - - ">="
226
228
  - !ruby/object:Gem::Version
227
- version: 2.1.0
229
+ version: 2.4.0
228
230
  required_rubygems_version: !ruby/object:Gem::Requirement
229
231
  requirements:
230
232
  - - ">="