plaid 9.0.0 → 12.0.0

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: 8b01d399843f5783e0e0cf64e88392b8c883eb29288d8c0535c1b7fbc9c34c32
4
- data.tar.gz: 8c267612077441ef461b8b590f4a40959d680085558d42145b0cc2d179e5a726
3
+ metadata.gz: ff88844aefb3173ccb877c8764119b67120d08a2f7d3425eef174236be4b6161
4
+ data.tar.gz: 21103e33e95a4a54d984bdd4e30c0ac7c8e750f18eb542660ed8f55fc10a91c2
5
5
  SHA512:
6
- metadata.gz: e976a0ba72f8a33ac057ce3fe0589324934c8e292a314acc33ad9014999fa8e230beb15b45ee02a8f55a4c3c0b12c668a453091f1f9d091ac16add0575217038
7
- data.tar.gz: 9b91b0105aa3ac0450d6bc38158390ebff5bc70066eb2d61924cd17039c7a9f670a9d1282169b38a2fb3ca860cf4af9ef14082ae992cdfe5b309bcb9a80b01f8
6
+ metadata.gz: 01dd7019a4fd8ee33dc4ebc5bdd069e5c2188476e835a806d8d1e170e84d0eb00f831cba66c65ab73db7264b54a264732e0c00a811f8be94d6f03c09f1f6c2bb
7
+ data.tar.gz: 363f9143a45caacc0abb0a668f7be9ee019e082814bec7545c00e092770faf2dca0cabe9304aef0624864acdaea8afc60a0baee2fe84209f1074f6bf785e99b2
@@ -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'
@@ -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
@@ -1,3 +1,44 @@
1
+ # 12.0.0
2
+
3
+ - 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.
4
+ - the `/item/public_token/create` endpoint has been disabled in favor of the /link/token/create
5
+ endpoint
6
+ - The `/item/add_token/create endpoint` has been disabled in favor of the /link/token/create
7
+ - The `/payment_initiation/payment/token/create` endpoint has been disabled in favor of the /link/token/create
8
+ endpoint
9
+ - The `/item/remove` endpoint will no longer return a `removed` boolean.
10
+ - The `/institutions/get`, `/institutions/get_by_id`, and `/institutions/search` now require
11
+ `country_codes` to be passed in.
12
+
13
+ # 11.1.0
14
+
15
+ - Add support for Link Token get endpoint ([#301](https://github.com/plaid/plaid-ruby/pull/301))
16
+ - `link/token/get`
17
+
18
+ # 11.0.0
19
+
20
+ - Add `merchant_name` to `Transaction` (#294)
21
+
22
+ BREAKING CHANGES:
23
+
24
+ - Removes the public key as input to `Client`. The public key is no longer needed by the API. (#287)
25
+ - Add link/token/create support (#293)
26
+
27
+ # 10.1.0
28
+
29
+ - 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))
30
+
31
+ # 10.0.0
32
+
33
+ - Add support for optional user fields for `/item/add_token/create` endpoint ([278](https://github.com/plaid/plaid-ruby/pull/278))
34
+ - Add support for credit card liabilities ([286](https://github.com/plaid/plaid-ruby/pull/286))
35
+
36
+ BREAKING CHANGES:
37
+
38
+ - `RATE_LIMIT_EXCEEDED` Plaid error types will be correctly mapped to `RateLimitExceededError` ([285](https://github.com/plaid/plaid-ruby/pull/285))
39
+ - `INSTITUTION_ERROR` Plaid error types will be correctly mapped to `InstitutionError` ([275](https://github.com/plaid/plaid-ruby/pull/275))
40
+ - Enable payment recipient to be created with BACS ([288](https://github.com/plaid/plaid-ruby/pull/288))
41
+
1
42
  # 9.0.0
2
43
 
3
44
  - Adds support for `/sandbox/item/set_verification_status`
@@ -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
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- plaid (9.0.0)
4
+ plaid (12.0.0)
5
5
  faraday
6
6
  faraday_middleware
7
7
  hashie (>= 3.4.3)
data/PUBLISH.md CHANGED
@@ -2,13 +2,19 @@
2
2
 
3
3
  The module is published to [RubyGems][1] under the gem name [plaid][2].
4
4
 
5
- To publish:
5
+ Prepare release:
6
6
 
7
- 1. `rake test` (runs the test suite locally).
8
- 2. Update, commit, and merge (with review) the `lib/plaid/version.rb` and `CHANGELOG.md` files.
9
- 5. `git pull` (makes sure your `HEAD` is up-to-date).
10
- 6. `rake release` (builds the gem, creates a tag, pushes the gem to RubyGems and tag to GitHub).
11
- 7. `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.)
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.)
12
18
 
13
19
  [1]: https://rubygems.org/
14
20
  [2]: https://rubygems.org/gems/plaid
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
- | [`2019-05-29`][api-version-2019-05-29] (**latest**) | `9.x.x`, `8.x.x`, `7.x.x` |
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`, `secret`, and `public_key` from your Plaid dashboard along with your environment of choice:
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: '***', public_key: '***') do |builder|
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
@@ -208,6 +226,8 @@ Any methods making API calls will result in an exception raised unless the respo
208
226
 
209
227
  `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
228
 
229
+ `Plaid::InstitutionError` is returned when there are errors for the requested financial institution.
230
+
211
231
  Read more about response codes and their meaning in the
212
232
  [Plaid documentation](https://plaid.com/docs/api).
213
233
 
@@ -241,3 +261,4 @@ If you're looking for a Ruby client that works with the legacy Plaid API, use th
241
261
  [version-changelog]: https://plaid.com/docs/api-upgrades
242
262
  [api-version-2018-05-22]: https://plaid.com/docs/api-upgrades#2018-05-22
243
263
  [api-version-2019-05-29]: https://plaid.com/docs/api-upgrades#2019-05-29
264
+ [api-version-2020-09-14]: https://plaid.com/docs/api-upgrades#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]
@@ -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'
@@ -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.
@@ -58,14 +58,19 @@ TEXT
58
58
  # Plaid's platform.
59
59
  class ItemError < PlaidAPIError; end
60
60
 
61
+ # Public: Returned when there are errors for the requested financial
62
+ # institution.
63
+ class InstitutionError < PlaidAPIError; end
64
+
61
65
  # Internal: A module that provides utilities for errors.
62
66
  module Error
63
67
  ERROR_TYPE_MAP = {
64
68
  'INVALID_REQUEST' => Plaid::InvalidRequestError,
65
69
  'INVALID_INPUT' => Plaid::InvalidInputError,
66
- 'RATE_LIMIT_EXCEEDED_ERROR' => Plaid::RateLimitExceededError,
70
+ 'RATE_LIMIT_EXCEEDED' => Plaid::RateLimitExceededError,
67
71
  'API_ERROR' => Plaid::APIError,
68
- 'ITEM_ERROR' => Plaid::ItemError
72
+ 'ITEM_ERROR' => Plaid::ItemError,
73
+ 'INSTITUTION_ERROR' => Plaid::InstitutionError
69
74
  }.freeze
70
75
 
71
76
  # Internal: Map error_type to PlaidAPIError.
@@ -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).
@@ -1812,6 +1818,84 @@ module Plaid
1812
1818
  property :ytd_principal_paid
1813
1819
  end
1814
1820
 
1821
+ # Public: A representation of a credit card liability APR
1822
+ class CreditCardLiabilityAPRs < BaseModel
1823
+ ##
1824
+ # :attr_reader:
1825
+ # Public: Annual Percentage Rate applied.
1826
+ property :apr_percentage
1827
+
1828
+ ##
1829
+ # :attr_reader:
1830
+ # Public: Enumerated response from the following options:
1831
+ # "balance_transfer_apr", "cash_apr", "purchase_apr", or
1832
+ # "special".
1833
+ property :apr_type
1834
+
1835
+ ##
1836
+ # :attr_reader:
1837
+ # Public: Amount of money that is subjected to the APR if a
1838
+ # balance was carried beyond payment due date. How it is
1839
+ # calculated can vary by card issuer. It is often calculated as
1840
+ # an average daily balance.
1841
+ property :balance_subject_to_apr
1842
+
1843
+ ##
1844
+ # :attr_reader:
1845
+ # Public: Amount of money charged due to interest from last
1846
+ # statement.
1847
+ property :interest_charge_amount
1848
+ end
1849
+
1850
+ # Public: A representation of a credit card liability
1851
+ class CreditCardLiability < BaseModel
1852
+ ##
1853
+ # :attr_reader:
1854
+ # Public: The ID of the account that this liability belongs to.
1855
+ property :account_id
1856
+
1857
+ ##
1858
+ # :attr_reader:
1859
+ # Public: See the APR object schema
1860
+ property :aprs, coerce: Array[CreditCardLiabilityAPRs]
1861
+
1862
+ ##
1863
+ # :attr_reader:
1864
+ # Public: true if a payment is currently overdue.
1865
+ property :is_overdue
1866
+
1867
+ ##
1868
+ # :attr_reader:
1869
+ # Public: The amount of the last payment.
1870
+ property :last_payment_amount
1871
+
1872
+ ##
1873
+ # :attr_reader:
1874
+ # Public: The date of the last payment.
1875
+ property :last_payment_date
1876
+
1877
+ ##
1878
+ # :attr_reader:
1879
+ # Public: The outstanding balance on the last statement.
1880
+ property :last_statement_balance
1881
+
1882
+ ##
1883
+ # :attr_reader:
1884
+ # Public: The date of the last statement.
1885
+ property :last_statement_issue_date
1886
+
1887
+ ##
1888
+ # :attr_reader:
1889
+ # Public: The minimum payment due for the next billing cycle.
1890
+ property :minimum_payment_amount
1891
+
1892
+ ##
1893
+ # :attr_reader:
1894
+ # Public: The due date for the next payment. The due date is null
1895
+ # if a payment is not expected.
1896
+ property :next_payment_due_date
1897
+ end
1898
+
1815
1899
  # Public: A representation of someone's liabilities of all types.
1816
1900
  class Liabilities < BaseModel
1817
1901
  include Hashie::Extensions::IgnoreUndeclared
@@ -1820,6 +1904,11 @@ module Plaid
1820
1904
  # :attr_reader:
1821
1905
  # Public: Student loan liabilities associated with the item.
1822
1906
  property :student, coerce: Array[StudentLoanLiability]
1907
+
1908
+ ##
1909
+ # :attr_reader:
1910
+ # Public: Credit card liabilities associated with the item.
1911
+ property :credit, coerce: Array[CreditCardLiability]
1823
1912
  end
1824
1913
 
1825
1914
  # Public: A representation of a payment amount.
@@ -1858,6 +1947,19 @@ module Plaid
1858
1947
  property :country
1859
1948
  end
1860
1949
 
1950
+ # Public: A representation of a payment recipient BACS number.
1951
+ class PaymentRecipientBACS < BaseModel
1952
+ ##
1953
+ # :attr_reader:
1954
+ # Public: The String account number. E.g. "66374958".
1955
+ property :account
1956
+
1957
+ ##
1958
+ # :attr_reader:
1959
+ # Public: The String sort code. E.g. "089999".
1960
+ property :sort_code
1961
+ end
1962
+
1861
1963
  # Public: A representation of a payment recipient.
1862
1964
  class PaymentRecipient < BaseModel
1863
1965
  ##
@@ -1875,6 +1977,11 @@ module Plaid
1875
1977
  # Public: The recipient IBAN.
1876
1978
  property :iban
1877
1979
 
1980
+ ##
1981
+ # :attr_reader:
1982
+ # Public: The recipient BACS number .
1983
+ property :bacs, coerce: PaymentRecipientBACS
1984
+
1878
1985
  ##
1879
1986
  # :attr_reader:
1880
1987
  # Public: The recipient address.
@@ -1924,6 +2031,44 @@ module Plaid
1924
2031
  property :recipient_id
1925
2032
  end
1926
2033
 
2034
+ # Public: Metadata associated with a link token.
2035
+ class LinkTokenMetadata < BaseModel
2036
+ ##
2037
+ # :attr_reader:
2038
+ # Public: List of products associated with the link token.
2039
+ property :initial_products
2040
+
2041
+ ##
2042
+ # :attr_reader:
2043
+ # Public: The webhook associated with the link token.
2044
+ property :webhook
2045
+
2046
+ ##
2047
+ # :attr_reader:
2048
+ # Public: The country codes associated with the link token.
2049
+ property :country_codes
2050
+
2051
+ ##
2052
+ # :attr_reader:
2053
+ # Public: The language associated with the link token.
2054
+ property :language
2055
+
2056
+ ##
2057
+ # :attr_reader:
2058
+ # Public: The account filters associated with the link token.
2059
+ property :account_filters
2060
+
2061
+ ##
2062
+ # :attr_reader:
2063
+ # Public: The redirect URI associated with the link token.
2064
+ property :redirect_uri
2065
+
2066
+ ##
2067
+ # :attr_reader:
2068
+ # Public: The client name associated with the link token.
2069
+ property :client_name
2070
+ end
2071
+
1927
2072
  # Public: A representation of a payment amount.
1928
2073
  class WebhookVerificationKey < BaseModel
1929
2074
  ##
@@ -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,57 +25,8 @@ 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
- # Public: Creates a public token from an access_token.
53
- #
54
- # Does a POST /item/public_token/create call which can be used to
55
- # initialize Link in update mode.
56
- #
57
- # access_token - access_token to create a public token for
58
- #
59
- # Returns a CreateResponse object with a public token and expiration info.
60
- def create(access_token)
61
- post_with_auth 'item/public_token/create',
62
- CreateResponse,
63
- access_token: access_token
64
- end
65
-
66
- # Public: Response for /item/public_token/create.
67
- class CreateResponse < Models::BaseResponse
68
- ##
69
- # :attr_reader:
70
- # Public: The String token.
71
- property :public_token
72
-
73
- ##
74
- # :attr_reader:
75
- # Public: The String token expiration time.
76
- property :expiration
77
- end
78
-
79
30
  # Public: Exchange a public token for an access_token
80
31
  #
81
32
  # Does a POST /item/public_token/exchange call helps you exchange a public
@@ -146,11 +97,6 @@ module Plaid
146
97
  # Public: The Plaid::PublicToken product accessor.
147
98
  subproduct :public_token
148
99
 
149
- ##
150
- # :attr_reader:
151
- # Public: The Plaid::AddToken product accessor.
152
- subproduct :add_token
153
-
154
100
  ##
155
101
  # :attr_reader:
156
102
  # 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
@@ -6,13 +6,15 @@ module Plaid
6
6
  # name - Recipient name.
7
7
  # iban - Recipient IBAN.
8
8
  # address - Recipient address.
9
+ # bacs - Recipient BACS (hash with "account" and "sort_code" keys)
9
10
  #
10
11
  # Returns a PaymentRecipientCreateResponse object.
11
- def create_recipient(name, iban, address)
12
+ def create_recipient(name, iban, address, bacs)
12
13
  post_with_auth 'payment_initiation/recipient/create',
13
14
  PaymentRecipientCreateResponse,
14
15
  name: name,
15
16
  iban: iban,
17
+ bacs: bacs,
16
18
  address: address
17
19
  end
18
20
 
@@ -51,17 +53,6 @@ module Plaid
51
53
  amount: amount
52
54
  end
53
55
 
54
- # Public: Create a payment token.
55
- #
56
- # payment_id - Payment ID that the token will be created for.
57
- #
58
- # Returns a PaymentTokenCreateResponse object.
59
- def create_payment_token(payment_id)
60
- post_with_auth 'payment_initiation/payment/token/create',
61
- PaymentTokenCreateResponse,
62
- payment_id: payment_id
63
- end
64
-
65
56
  # Public: Retrieve a payment.
66
57
  #
67
58
  # payment_id - The payment ID from the `create_payment` response.
@@ -112,6 +103,11 @@ module Plaid
112
103
  # Public: The recipient IBAN.
113
104
  property :iban
114
105
 
106
+ ##
107
+ # :attr_reader:
108
+ # Public: The recipient IBAN.
109
+ property :bacs, coerce: Models::PaymentRecipientBACS
110
+
115
111
  ##
116
112
  # :attr_reader:
117
113
  # Public: The recipient address.
@@ -139,19 +135,6 @@ module Plaid
139
135
  property :status
140
136
  end
141
137
 
142
- # Public: The response wrapper for /payment_initiation/payment/token/create.
143
- class PaymentTokenCreateResponse < Models::BaseResponse
144
- ##
145
- # :attr_reader:
146
- # Public: The payment token.
147
- property :payment_token
148
-
149
- ##
150
- # :attr_reader:
151
- # Public: The payment token's expiration time.
152
- property :payment_token_expiration_time
153
- end
154
-
155
138
  # Public: The response wrapper for /payment_initiation/payment/get.
156
139
  class PaymentGetResponse < Models::BaseResponse
157
140
  ##
@@ -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 - 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
- # options - Additional options to merge into API request.
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
- post_with_public_key 'sandbox/public_token/create',
96
- SandboxCreateResponse,
97
- institution_id: institution_id,
98
- initial_products: initial_products,
99
- 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
100
110
  end
101
111
 
102
112
  private def transaction_options(start_date, end_date)
@@ -1,4 +1,4 @@
1
1
  module Plaid
2
- VERSION = '9.0.0'.freeze
3
- API_VERSION = '2019-05-29'.freeze
2
+ VERSION = '12.0.0'.freeze
3
+ API_VERSION = '2020-09-14'.freeze
4
4
  end
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: 9.0.0
4
+ version: 12.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edmund Loo
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-15 00:00:00.000000000 Z
11
+ date: 2020-10-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
@@ -216,7 +218,7 @@ licenses:
216
218
  - MIT
217
219
  metadata:
218
220
  allowed_push_host: https://rubygems.org
219
- post_install_message:
221
+ post_install_message:
220
222
  rdoc_options: []
221
223
  require_paths:
222
224
  - lib
@@ -231,8 +233,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
231
233
  - !ruby/object:Gem::Version
232
234
  version: '0'
233
235
  requirements: []
234
- rubygems_version: 3.1.2
235
- signing_key:
236
+ rubygems_version: 3.0.3
237
+ signing_key:
236
238
  specification_version: 4
237
239
  summary: Ruby bindings for Plaid
238
240
  test_files: []