plaid 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,48 @@
1
+ module Plaid
2
+ # Public: Class used to call the BankAccountToken sub-product.
3
+ class BankAccountToken
4
+ def initialize(client)
5
+ @client = client
6
+ end
7
+
8
+ # Public: Creates a Stripe bank account token from an access_token.
9
+ #
10
+ # Does a POST /processor/stripe/bank_account_token/create call which can
11
+ # be used to generate a Stripe bank account token for a given account ID.
12
+ #
13
+ # access_token - access_token to create a public token for
14
+ # account_id - ID of the account to create a bank account token for
15
+ #
16
+ # Returns a parsed JSON containing a Stripe bank account token
17
+ def create(access_token, account_id)
18
+ payload = { access_token: access_token,
19
+ account_id: account_id }
20
+ @client.post_with_auth('processor/stripe/bank_account_token/create',
21
+ payload)
22
+ end
23
+ end
24
+
25
+ # Public: Class used to call the Stripe sub-product.
26
+ class Stripe
27
+ # Public: Memoized class instance to make requests from Plaid::BankAccountToken
28
+ def bank_account_token
29
+ @bank_account_token ||= Plaid::BankAccountToken.new(@client)
30
+ end
31
+
32
+ def initialize(client)
33
+ @client = client
34
+ end
35
+ end
36
+
37
+ # Public: Class used to call the Processor product.
38
+ class Processor
39
+ # Public: Memoized class instance to make requests from Plaid::Stripe
40
+ def stripe
41
+ @stripe ||= Plaid::Stripe.new(@client)
42
+ end
43
+
44
+ def initialize(client)
45
+ @client = client
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,32 @@
1
+ module Plaid
2
+ # Public: Class used to call the SandboxItem sub-product.
3
+ class SandboxItem
4
+ def initialize(client)
5
+ @client = client
6
+ end
7
+
8
+ # Public: Resets sandbox item login
9
+ #
10
+ # Does a POST /sandbox/item/reset_login call
11
+ #
12
+ # access_token - access_token who's item to reset login for
13
+ #
14
+ # Returns a parsed JSON of response
15
+ def reset_login(access_token)
16
+ payload = { access_token: access_token }
17
+ @client.post_with_auth('sandbox/item/reset_login', payload)
18
+ end
19
+ end
20
+
21
+ # Public: Class used to call the Sandbox product.
22
+ class Sandbox
23
+ # Public: Memoized class instance to make requests from Plaid::SandboxItem
24
+ def sandbox_item
25
+ @sandbox_item ||= Plaid::SandboxItem.new(@client)
26
+ end
27
+
28
+ def initialize(client)
29
+ @client = client
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,74 @@
1
+ require 'date'
2
+
3
+ module Plaid
4
+ # Internal: Converts date objects to strings if needed
5
+ #
6
+ # Takes in a string or a Date object and performs necessary operations to return a
7
+ # string representation of the Date
8
+ #
9
+ # date - Date in Date object form or string form (YYYY-MM-DD)
10
+ #
11
+ # Returns a string representing a date needed for transaction start and end dates
12
+ def self.convert_to_date_string(date)
13
+ case date
14
+ when String
15
+ date
16
+ else
17
+ date.to_date.strftime('%Y-%m-%d')
18
+ end
19
+ end
20
+
21
+ # Public: Class used to call the Transactions product.
22
+ class Transactions
23
+ def initialize(client)
24
+ @client = client
25
+ end
26
+
27
+ # Public: Get information about transactions
28
+ #
29
+ # Does a POST /transactions/get call which gives you high level account data along
30
+ # with transactions from all accounts contained in the access_token's item
31
+ #
32
+ # access_token - access_token who's item to fetch transactions for
33
+ # start_date - Start of query for transactions
34
+ # end_date - End of query for transactions
35
+ # account_ids - Specific account ids to fetch balances for (optional)
36
+ # count - Amount of transactions to pull (optional)
37
+ # offset - Offset to start pulling transactions (optional)
38
+ # options - Additional options to merge into API request
39
+ #
40
+ # Returns a parsed JSON listing information on transactions
41
+ def get(access_token,
42
+ start_date,
43
+ end_date,
44
+ account_ids: nil,
45
+ count: nil,
46
+ offset: nil,
47
+ options: nil)
48
+ options_payload = {}
49
+ options_payload[:account_ids] = account_ids unless account_ids.nil?
50
+ options_payload[:count] = count unless count.nil?
51
+ options_payload[:offset] = offset unless offset.nil?
52
+ options_payload = options_payload.merge(options) unless options.nil?
53
+
54
+ payload = { access_token: access_token,
55
+ start_date: Plaid.convert_to_date_string(start_date),
56
+ end_date: Plaid.convert_to_date_string(end_date),
57
+ options: options_payload }
58
+ @client.post_with_auth('transactions/get', payload)
59
+ end
60
+
61
+ # Public: Deactivate transactions for given access_token.
62
+ #
63
+ # Does a POST /transactions/deactivate call which deactivates the transaction product
64
+ # for a given access_token
65
+ #
66
+ # access_token - access_token to deactivate transactions for
67
+ #
68
+ # Returns a parsed JSON containing a message describing deactivation success.
69
+ def deactivate(access_token)
70
+ payload = { access_token: access_token }
71
+ @client.post_with_auth('transactions/deactivate', payload)
72
+ end
73
+ end
74
+ end
@@ -1,3 +1,3 @@
1
1
  module Plaid
2
- VERSION = '3.0.0'.freeze
2
+ VERSION = '4.0.0'.freeze
3
3
  end
@@ -6,16 +6,25 @@ require 'plaid/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'plaid'
8
8
  spec.version = Plaid::VERSION
9
- spec.authors = ['Oleg Dashevskii']
10
- spec.email = ['olegdashevskii@gmail.com']
9
+ spec.authors = ['Edmund Loo']
10
+ spec.email = ['eloo@plaid.com']
11
11
 
12
12
  spec.summary = 'Ruby bindings for Plaid'
13
13
  spec.description = 'Ruby gem wrapper for the Plaid API. Read more at the ' \
14
14
  'homepage, the wiki, or in the Plaid documentation.'
15
- spec.homepage = 'https://github.com/plaid/plaid-ruby'
15
+ spec.homepage = 'https://plaid.com/'
16
16
  spec.license = 'MIT'
17
17
 
18
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
19
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
20
+ if spec.respond_to?(:metadata)
21
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
22
+ else
23
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
24
+ 'public gem pushes.'
25
+ end
26
+
27
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
28
  f.match(%r{^(test/|\.gitignore|\.travis)})
20
29
  end
21
30
 
@@ -25,12 +34,8 @@ Gem::Specification.new do |spec|
25
34
 
26
35
  spec.required_ruby_version = '>= 2.0.0'
27
36
 
28
- spec.add_dependency 'multi_json', '~> 1.0'
29
-
30
37
  spec.add_development_dependency 'bundler', '~> 1.7'
31
38
  spec.add_development_dependency 'rake', '~> 10.0'
32
39
  spec.add_development_dependency 'sdoc', '~> 0.4.1'
33
- spec.add_development_dependency 'pry', '~> 0.10.3'
34
- spec.add_development_dependency 'webmock', '~> 2.0.0'
35
40
  spec.add_development_dependency 'minitest', '~> 5.8'
36
41
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plaid
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Oleg Dashevskii
7
+ - Edmund Loo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-18 00:00:00.000000000 Z
11
+ date: 2017-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: multi_json
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: bundler
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -66,34 +52,6 @@ dependencies:
66
52
  - - "~>"
67
53
  - !ruby/object:Gem::Version
68
54
  version: 0.4.1
69
- - !ruby/object:Gem::Dependency
70
- name: pry
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 0.10.3
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 0.10.3
83
- - !ruby/object:Gem::Dependency
84
- name: webmock
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: 2.0.0
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: 2.0.0
97
55
  - !ruby/object:Gem::Dependency
98
56
  name: minitest
99
57
  requirement: !ruby/object:Gem::Requirement
@@ -111,39 +69,41 @@ dependencies:
111
69
  description: Ruby gem wrapper for the Plaid API. Read more at the homepage, the wiki,
112
70
  or in the Plaid documentation.
113
71
  email:
114
- - olegdashevskii@gmail.com
72
+ - eloo@plaid.com
115
73
  executables: []
116
74
  extensions: []
117
75
  extra_rdoc_files: []
118
76
  files:
119
- - CHANGELOG.md
120
77
  - CONTRIBUTING.md
121
78
  - Gemfile
122
- - LICENSE
79
+ - LICENSE.txt
123
80
  - README.md
124
81
  - Rakefile
125
- - UPGRADING.md
126
82
  - bin/console
127
83
  - bin/setup
84
+ - circle.yml
128
85
  - lib/plaid.rb
129
- - lib/plaid/account.rb
130
- - lib/plaid/category.rb
131
86
  - lib/plaid/client.rb
132
- - lib/plaid/connector.rb
87
+ - lib/plaid/connect.rb
133
88
  - lib/plaid/errors.rb
134
- - lib/plaid/income.rb
135
- - lib/plaid/info.rb
136
- - lib/plaid/institution.rb
137
- - lib/plaid/risk.rb
138
- - lib/plaid/transaction.rb
139
- - lib/plaid/user.rb
89
+ - lib/plaid/products/accounts.rb
90
+ - lib/plaid/products/auth.rb
91
+ - lib/plaid/products/categories.rb
92
+ - lib/plaid/products/credit_details.rb
93
+ - lib/plaid/products/identity.rb
94
+ - lib/plaid/products/income.rb
95
+ - lib/plaid/products/institutions.rb
96
+ - lib/plaid/products/item.rb
97
+ - lib/plaid/products/processor.rb
98
+ - lib/plaid/products/sandbox.rb
99
+ - lib/plaid/products/transactions.rb
140
100
  - lib/plaid/version.rb
141
- - lib/plaid/webhook.rb
142
101
  - plaid.gemspec
143
- homepage: https://github.com/plaid/plaid-ruby
102
+ homepage: https://plaid.com/
144
103
  licenses:
145
104
  - MIT
146
- metadata: {}
105
+ metadata:
106
+ allowed_push_host: https://rubygems.org
147
107
  post_install_message:
148
108
  rdoc_options: []
149
109
  require_paths:
@@ -1,34 +0,0 @@
1
- # 3.0.0. 17-Jan-2017
2
-
3
- * Add `/institutions/all` and `/institutions/all/search` endpoints, see [UPGRADING.md](UPGRADING.md#upgrading-from-2xx-to-300)
4
-
5
- # 2.2.0. 03-Nov-2016
6
-
7
- * Add `Transaction#reference_number` (@ericbirdsall).
8
- * Fix webhook codes and add risk and income webhooks.
9
-
10
- # 2.1.0. 19-Oct-2016
11
-
12
- * Documentation fixes (@ishmael).
13
- * Fix `Transaction#to_s` behavior (@michel-tricot).
14
- * PATCH `/:product/step` flow.
15
- * Use the same client in `User#upgrade` (@betesh).
16
- * Webhook object (@zshannon).
17
- * `processor_token` access in `User.exchange_token` (@gylaz).
18
- * Raise `ServerError` in case server returned an empty response body.
19
-
20
- # 2.0.0. 24-May-2016
21
-
22
- * Use `~> 1.0` spec for multi_json dependency.
23
- * Support `stripe_bank_account_token` in `User.exchange_token`.
24
-
25
- # 2.0.0.alpha.2. 14-May-2016
26
-
27
- * Use `:production` instead of `:api` to signify production environment
28
- in `Plaid::Client#env=`.
29
- * `User#mfa_step` allows to specify options now (thanks @gcweeks).
30
- * Implemented `User#update_webhook`.
31
-
32
- # 2.0.0.alpha. 06-May-2016
33
-
34
- * Rewrite everything.
data/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016 Plaid Technologies, Inc.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the "Software"), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,60 +0,0 @@
1
- ## Upgrading from 2.x.x to 3.0.0
2
-
3
- Version 3.0.0 makes `Plaid::Institution` use new `institutions/all` endpoint
4
- of Plaid API which unites "native" and "long tail" institutions.
5
- `Plaid::LongTailInstitution` class is removed, its functionality is
6
- concentrated in `Plaid::Institution`.
7
-
8
- Use `Plaid::Institution.all` instead of `Plaid::LongTailInstitution.all` (the
9
- semantics is the same, with added products param).
10
-
11
- Use `Plaid::Institution.search` instead of `Plaid::LongTailInstitution.search`.
12
-
13
- Use `Plaid::Institution.search_by_id` instead of `Plaid::LongTailInstitution.get`.
14
-
15
-
16
- ## Upgrading from 1.x to 2.0.0
17
-
18
- Make sure you use Ruby 2.0 or higher.
19
-
20
- Update the `Plaid.config` block:
21
-
22
- ```ruby
23
- Plaid.config do |p|
24
- p.client_id = '<<< Plaid provided client ID >>>' # WAS: customer_id
25
- p.secret = '<<< Plaid provided secret key >>>' # No change
26
- p.env = :tartan # or :api for production # WAS: environment_location
27
- end
28
- ```
29
-
30
- Use `Plaid::User.create` instead of `Plaid.add_user` (**NOTE**: parameter order has changed!)
31
-
32
- Use `Plaid::User.load` instead of `Plaid.set_user` (**NOTE**: parameter order has changed!)
33
-
34
- Use `Plaid::User.exchange_token` instead of `Plaid.exchange_token` (**NOTE**: parameter list has changed!)
35
-
36
- Use `Plaid::User.create` or (`.load`) and `Plaid::User#transactions` instead of `Plaid.transactions`.
37
-
38
- Use `Plaid::Institution.all` and `Plaid::Institution.get` instead of `Plaid.institution`.
39
-
40
- Use `Plaid::Category.all` and `Plaid::Category.get` instead of `Plaid.category`.
41
-
42
- `Plaid::Account#institution_type` was renamed to `Plaid::Account#institution`.
43
-
44
- `Plaid::Transaction#account` was renamed to `Plaid::Transaction#account_id`.
45
-
46
- `Plaid::Transaction#date` is a Date, not a String object now.
47
-
48
- `Plaid::Transaction#cat` was removed. Use `Plaid::Transaction#category_hierarchy` and `Plaid::Transaction#category_id` directly.
49
-
50
- `Plaid::Transaction#category` was renamed to `Plaid::Transaction#category_hierarchy`.
51
-
52
- `Plaid::Transaction#pending_transaction` was renamed to `Plaid::Transaction#pending_transaction_id`.
53
-
54
- Use `Plaid::User#mfa_step` instead of `Plaid::User#select_mfa_method` and `Plaid::User#mfa_authentication`.
55
-
56
- `Plaid::User#permit?` was removed. You don't need this.
57
-
58
- `Plaid::User.delete_user` was renamed to `Plaid::User.delete`.
59
-
60
- **NOTE** that Symbols are now consistently used instead of Strings as product names, keys in hashes, etc. Look at the docs, they have all the examples.