plaid 7.0.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +16 -18
- data/CHANGELOG.md +8 -0
- data/CONTRIBUTING.md +7 -0
- data/README.md +3 -1
- data/lib/plaid.rb +1 -0
- data/lib/plaid/client.rb +5 -0
- data/lib/plaid/models.rb +207 -0
- data/lib/plaid/products/investments.rb +127 -0
- data/lib/plaid/products/item.rb +0 -154
- data/lib/plaid/products/sandbox.rb +15 -0
- data/lib/plaid/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bac1f4f002db7e866fd402fc1f5ffd564a4aa241
|
4
|
+
data.tar.gz: ef365c86c2c8443b0f9e1f74f497edfd62e3150e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0146aba875c55d08295b0f0488c7e8517977480c4d54a0b1e031081677e8b3854a961ee3cd8ededcd3d5a0ecc992e6fb3cd1357c2c0b9cc735b15b05a7e87462
|
7
|
+
data.tar.gz: d270ce69ab7a41afa2f53e76b1bce551f8683cfb9e4c5749cb2bf64bd5d22a87e87c914fabb50d63a2de227163dce4af940f42d0bc05a0a11ea247f696c3d3c7
|
data/.circleci/config.yml
CHANGED
@@ -1,23 +1,21 @@
|
|
1
1
|
version: 2
|
2
|
-
|
3
2
|
jobs:
|
4
3
|
build:
|
5
4
|
docker:
|
6
|
-
|
5
|
+
- image: circleci/ruby:2.3
|
7
6
|
steps:
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
7
|
+
- checkout
|
8
|
+
- run:
|
9
|
+
name: Bundle Install
|
10
|
+
command: bundle check || bundle install
|
11
|
+
- run:
|
12
|
+
name: Stubbed API test
|
13
|
+
command: bundle exec rake test
|
14
|
+
environment:
|
15
|
+
STUB_API: true
|
16
|
+
- run:
|
17
|
+
name: Live API test
|
18
|
+
command: bundle exec rake test
|
19
|
+
- run:
|
20
|
+
name: Rubocop test
|
21
|
+
command: bundle exec rubocop
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# 8.0.0 19-Jun-2019
|
2
|
+
|
3
|
+
* Deprecate direct integration as it is no longer supported
|
4
|
+
|
5
|
+
# 7.1.0 17-Jun-2019
|
6
|
+
|
7
|
+
* Add bindings for the new [investments product](https://plaid.com/docs/api/#investments).
|
8
|
+
|
1
9
|
# 7.0.0 20-May-2019
|
2
10
|
|
3
11
|
* Add support for 2019-05-29 API version
|
data/CONTRIBUTING.md
CHANGED
@@ -44,6 +44,13 @@ changes in API you'll need to update the pre-recorded responses. Here's how:
|
|
44
44
|
stubbed ones used by `STUB_API=1 rake test`.
|
45
45
|
4. Run `STUB_API=1 rake test` and verify that everything works.
|
46
46
|
|
47
|
+
|
48
|
+
## Running lint
|
49
|
+
|
50
|
+
```bash
|
51
|
+
bundle exec rubocop
|
52
|
+
```
|
53
|
+
|
47
54
|
## Contributing
|
48
55
|
|
49
56
|
1. Make one or more atomic commits, and ensure that each commit has a
|
data/README.md
CHANGED
@@ -26,7 +26,7 @@ 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**) | `7.x.x` |
|
29
|
+
| [`2019-05-29`][api-version-2019-05-29] (**latest**) | `8.x.x`, `7.x.x` |
|
30
30
|
| [`2018-05-22`][api-version-2018-05-22] | `6.x.x` |
|
31
31
|
| `2017-03-08` | `5.x.x` |
|
32
32
|
|
@@ -172,6 +172,8 @@ There are also a number of other methods you can use to retrieve data:
|
|
172
172
|
* `client.identity.get(access_token, ...)`: identity
|
173
173
|
* `client.transactions.get(access_token, ...)`: transactions
|
174
174
|
* `client.credit_details.get(access_token, ...)`: credit details
|
175
|
+
* `client.investments.transactions.get(access_token, ...)`: investment-account transactions
|
176
|
+
* `client.investments.holdings.get(access_token, ...)`: investment-account holdings
|
175
177
|
|
176
178
|
All of these methods return appropriate data. More information can be found on the [API documentation](https://plaid.com/docs/api).
|
177
179
|
|
data/lib/plaid.rb
CHANGED
@@ -18,6 +18,7 @@ require_relative 'plaid/products/item'
|
|
18
18
|
require_relative 'plaid/products/processor'
|
19
19
|
require_relative 'plaid/products/sandbox'
|
20
20
|
require_relative 'plaid/products/transactions'
|
21
|
+
require_relative 'plaid/products/investments'
|
21
22
|
require_relative 'plaid/client'
|
22
23
|
|
23
24
|
# Public: The namespace for all the things Plaid.
|
data/lib/plaid/client.rb
CHANGED
@@ -92,6 +92,11 @@ module Plaid
|
|
92
92
|
# Public: The Plaid::Transactions product accessor.
|
93
93
|
subproduct :transactions
|
94
94
|
|
95
|
+
##
|
96
|
+
# :attr_reader:
|
97
|
+
# Public: The Plaid::Investments product accessor.
|
98
|
+
subproduct :investments
|
99
|
+
|
95
100
|
# Public: Make a post request
|
96
101
|
#
|
97
102
|
# path - Path or URL to make the request to
|
data/lib/plaid/models.rb
CHANGED
@@ -983,6 +983,213 @@ module Plaid
|
|
983
983
|
property :unofficial_currency_code
|
984
984
|
end
|
985
985
|
|
986
|
+
# Public: A representation of an InvestmentTransaction in an investment
|
987
|
+
# account.
|
988
|
+
class InvestmentTransaction < BaseModel
|
989
|
+
##
|
990
|
+
# :attr_reader:
|
991
|
+
# Public: The String investment transaction ID.
|
992
|
+
property :investment_transaction_id
|
993
|
+
|
994
|
+
##
|
995
|
+
# :attr_reader:
|
996
|
+
# Public: The String account ID.
|
997
|
+
property :account_id
|
998
|
+
|
999
|
+
##
|
1000
|
+
# :attr_reader:
|
1001
|
+
# Public: The String security ID.
|
1002
|
+
property :security_id
|
1003
|
+
|
1004
|
+
##
|
1005
|
+
# :attr_reader:
|
1006
|
+
# Public: The String transaction date. E.g. "2017-01-01".
|
1007
|
+
property :date
|
1008
|
+
|
1009
|
+
##
|
1010
|
+
# :attr_reader:
|
1011
|
+
# Public: The String transaction name (or nil).
|
1012
|
+
# E.g. "CREDIT CARD 3333 PAYMENT *//".
|
1013
|
+
property :name
|
1014
|
+
|
1015
|
+
##
|
1016
|
+
# :attr_reader:
|
1017
|
+
# Public: The Numeric quantity of the security involved (if applicable).
|
1018
|
+
property :quantity
|
1019
|
+
|
1020
|
+
##
|
1021
|
+
# :attr_reader:
|
1022
|
+
# Public: The Numeric amount (or nil).
|
1023
|
+
property :amount
|
1024
|
+
|
1025
|
+
##
|
1026
|
+
# :attr_reader:
|
1027
|
+
# Public: The Numeric price of the security that was used for the trade
|
1028
|
+
# (if applicable).
|
1029
|
+
property :price
|
1030
|
+
|
1031
|
+
##
|
1032
|
+
# :attr_reader:
|
1033
|
+
# Public: The Numeric fee amount.
|
1034
|
+
property :fees
|
1035
|
+
|
1036
|
+
##
|
1037
|
+
# :attr_reader:
|
1038
|
+
# Public: The String transaction type (or nil). E.g. "buy" or "sell".
|
1039
|
+
property :type
|
1040
|
+
|
1041
|
+
##
|
1042
|
+
# :attr_reader:
|
1043
|
+
# Public: The ISO currency code of the transaction, either USD or CAD.
|
1044
|
+
# Always nil if unofficial_currency_code is non-nil.
|
1045
|
+
property :iso_currency_code
|
1046
|
+
|
1047
|
+
##
|
1048
|
+
# :attr_reader:
|
1049
|
+
# Public: The unofficial currency code associated with the transaction.
|
1050
|
+
# Always nil if iso_currency_code is non-nil.
|
1051
|
+
property :unofficial_currency_code
|
1052
|
+
|
1053
|
+
##
|
1054
|
+
# :attr_reader:
|
1055
|
+
# Public: Present if the transaction class is cancel, and indicates the
|
1056
|
+
# ID of the transaction which was cancelled.
|
1057
|
+
property :cancel_transaction_id
|
1058
|
+
end
|
1059
|
+
|
1060
|
+
# Public: A representation of a Holding in an investment account.
|
1061
|
+
class Holding < BaseModel
|
1062
|
+
##
|
1063
|
+
# :attr_reader:
|
1064
|
+
# Public: The String account ID.
|
1065
|
+
property :account_id
|
1066
|
+
|
1067
|
+
##
|
1068
|
+
# :attr_reader:
|
1069
|
+
# Public: The String security ID.
|
1070
|
+
property :security_id
|
1071
|
+
|
1072
|
+
##
|
1073
|
+
# :attr_reader:
|
1074
|
+
# Public: The Numeric value of the holding (price * quantity) as reported
|
1075
|
+
# by the institution.
|
1076
|
+
property :institution_value
|
1077
|
+
|
1078
|
+
##
|
1079
|
+
# :attr_reader:
|
1080
|
+
# Public: The Numeric price of the holding as reported by the institution.
|
1081
|
+
property :institution_price
|
1082
|
+
|
1083
|
+
##
|
1084
|
+
# :attr_reader:
|
1085
|
+
# Public: The Numeric quantity.
|
1086
|
+
property :quantity
|
1087
|
+
|
1088
|
+
##
|
1089
|
+
# :attr_reader:
|
1090
|
+
# Public: The String date when the price reported by the institution was
|
1091
|
+
# current. E.g. "2017-01-01".
|
1092
|
+
property :institution_price_as_of
|
1093
|
+
|
1094
|
+
##
|
1095
|
+
# :attr_reader:
|
1096
|
+
# Public: The Numeric cost basis.
|
1097
|
+
property :cost_basis
|
1098
|
+
|
1099
|
+
##
|
1100
|
+
# :attr_reader:
|
1101
|
+
# Public: The ISO currency code of the holding, either USD or CAD.
|
1102
|
+
# Always nil if unofficial_currency_code is non-nil.
|
1103
|
+
property :iso_currency_code
|
1104
|
+
|
1105
|
+
##
|
1106
|
+
# :attr_reader:
|
1107
|
+
# Public: The unofficial currency code associated with the holding.
|
1108
|
+
# Always nil if iso_currency_code is non-nil.
|
1109
|
+
property :unofficial_currency_code
|
1110
|
+
end
|
1111
|
+
|
1112
|
+
# Public: A representation of a Security.
|
1113
|
+
class Security < BaseModel
|
1114
|
+
##
|
1115
|
+
# :attr_reader:
|
1116
|
+
# Public: The String security ID.
|
1117
|
+
property :security_id
|
1118
|
+
|
1119
|
+
##
|
1120
|
+
# :attr_reader:
|
1121
|
+
# Public: The String CUSIP identitfier of this security.
|
1122
|
+
property :cusip
|
1123
|
+
|
1124
|
+
##
|
1125
|
+
# :attr_reader:
|
1126
|
+
# Public: The String SEDOL identifier of this security.
|
1127
|
+
property :sedol
|
1128
|
+
|
1129
|
+
##
|
1130
|
+
# :attr_reader:
|
1131
|
+
# Public: The String ISIN identifier of this security.
|
1132
|
+
property :isin
|
1133
|
+
|
1134
|
+
##
|
1135
|
+
# :attr_reader:
|
1136
|
+
# Public: The String ID of this security as reported by the institution.
|
1137
|
+
property :institution_security_id
|
1138
|
+
|
1139
|
+
##
|
1140
|
+
# :attr_reader:
|
1141
|
+
# Public: The String institution ID (if institution_security_id is set).
|
1142
|
+
property :institution_id
|
1143
|
+
|
1144
|
+
##
|
1145
|
+
# :attr_reader:
|
1146
|
+
# Public: The String security ID of the proxied security.
|
1147
|
+
property :proxy_security_id
|
1148
|
+
|
1149
|
+
##
|
1150
|
+
# :attr_reader:
|
1151
|
+
# Public: The String security name.
|
1152
|
+
property :name
|
1153
|
+
|
1154
|
+
##
|
1155
|
+
# :attr_reader:
|
1156
|
+
# Public: The String ticker symbol.
|
1157
|
+
property :ticker_symbol
|
1158
|
+
|
1159
|
+
##
|
1160
|
+
# :attr_reader:
|
1161
|
+
# Public: The Boolean flag indicating whether this security is
|
1162
|
+
# cash-equivalent.
|
1163
|
+
property :is_cash_equivalent
|
1164
|
+
|
1165
|
+
##
|
1166
|
+
# :attr_reader:
|
1167
|
+
# Public: The String Type.
|
1168
|
+
property :type
|
1169
|
+
|
1170
|
+
##
|
1171
|
+
# :attr_reader:
|
1172
|
+
# Public: The Numeric close price.
|
1173
|
+
property :close_price
|
1174
|
+
|
1175
|
+
##
|
1176
|
+
# :attr_reader:
|
1177
|
+
# Public: The String date when the close price was current.
|
1178
|
+
property :close_price_as_of
|
1179
|
+
|
1180
|
+
##
|
1181
|
+
# :attr_reader:
|
1182
|
+
# Public: The ISO currency code of the security, either USD or CAD.
|
1183
|
+
# Always nil if unofficial_currency_code is non-nil.
|
1184
|
+
property :iso_currency_code
|
1185
|
+
|
1186
|
+
##
|
1187
|
+
# :attr_reader:
|
1188
|
+
# Public: The unofficial currency code associated with the security.
|
1189
|
+
# Always nil if iso_currency_code is non-nil.
|
1190
|
+
property :unofficial_currency_code
|
1191
|
+
end
|
1192
|
+
|
986
1193
|
# Public: A representation of asset report address details.
|
987
1194
|
class AssetReportAddressData < BaseModel
|
988
1195
|
##
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Plaid
|
4
|
+
# Public: Class used to get InvestmentTransactions for the Investments
|
5
|
+
# product.
|
6
|
+
class InvestmentTransactions < BaseProduct
|
7
|
+
# Public: Get information about all available investment transactions.
|
8
|
+
#
|
9
|
+
# Does a POST /investments/transactions/get call which gives you high level
|
10
|
+
# account data along with investment transactions and associated securities
|
11
|
+
# from all investment accounts contained in the access_token's item.
|
12
|
+
#
|
13
|
+
# access_token - access_token who's item to get investment transactions for.
|
14
|
+
# start_date - Start of query for investment transactions.
|
15
|
+
# end_date - End of query for investment transactions.
|
16
|
+
# account_ids - Specific account ids to fetch transactions for (optional).
|
17
|
+
# count - Amount of investment transactions to pull (optional).
|
18
|
+
# offset - Offset to start pulling investment transactions (optional).
|
19
|
+
# options - Additional options to merge into API request.
|
20
|
+
#
|
21
|
+
# Returns GetResponse.
|
22
|
+
def get(access_token, start_date, end_date,
|
23
|
+
account_ids: nil, count: nil, offset: nil, options: nil)
|
24
|
+
|
25
|
+
options_payload = {}
|
26
|
+
options_payload[:account_ids] = account_ids unless account_ids.nil?
|
27
|
+
options_payload[:count] = count unless count.nil?
|
28
|
+
options_payload[:offset] = offset unless offset.nil?
|
29
|
+
options_payload.merge!(options) unless options.nil?
|
30
|
+
|
31
|
+
post_with_auth 'investments/transactions/get',
|
32
|
+
GetResponse,
|
33
|
+
access_token: access_token,
|
34
|
+
start_date: Plaid.convert_to_date_string(start_date),
|
35
|
+
end_date: Plaid.convert_to_date_string(end_date),
|
36
|
+
options: options_payload
|
37
|
+
end
|
38
|
+
|
39
|
+
# Public: Response for /investments/transactions/get.
|
40
|
+
class GetResponse < Models::BaseResponse
|
41
|
+
##
|
42
|
+
# :attr_reader:
|
43
|
+
# Public: The item: Plaid::Models::Item.
|
44
|
+
property :item, coerce: Models::Item
|
45
|
+
|
46
|
+
##
|
47
|
+
# :attr_reader:
|
48
|
+
# Public: The list of accounts: Array of Plaid::Models::Account.
|
49
|
+
property :accounts, coerce: Array[Models::Account]
|
50
|
+
|
51
|
+
##
|
52
|
+
# :attr_reader:
|
53
|
+
# Public: The list of investment transactions: Array of
|
54
|
+
# Plaid::Models::InvestmentTransaction.
|
55
|
+
property :investment_transactions,
|
56
|
+
coerce: Array[Models::InvestmentTransaction]
|
57
|
+
|
58
|
+
##
|
59
|
+
# :attr_reader:
|
60
|
+
# Public: The list of securities referenced by the investment
|
61
|
+
# transactions: Array of Plaid::Models::Security.
|
62
|
+
property :securities, coerce: Array[Models::Security]
|
63
|
+
|
64
|
+
##
|
65
|
+
# :attr_reader:
|
66
|
+
# Public: The Numeric total investment transactions count.
|
67
|
+
property :total_investment_transactions
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Public: Class used to get Holdings for the Investments product.
|
72
|
+
class Holdings < BaseProduct
|
73
|
+
# Public: Get information about all available investment holdings.
|
74
|
+
#
|
75
|
+
# Does a POST /investments/holdings/get call which gives you high level
|
76
|
+
# account data along with investment holdings and associated securities
|
77
|
+
# from all investment accounts contained in the access_token's item.
|
78
|
+
#
|
79
|
+
# access_token - access_token who's item to fetch holdings for.
|
80
|
+
# account_ids - Specific account ids to fetch holdings for (optional).
|
81
|
+
# options - Additional options to merge into API request.
|
82
|
+
#
|
83
|
+
# Returns GetResponse.
|
84
|
+
def get(access_token, account_ids: nil, options: nil)
|
85
|
+
post_with_auth 'investments/holdings/get',
|
86
|
+
GetResponse,
|
87
|
+
build_payload(access_token,
|
88
|
+
account_ids: account_ids,
|
89
|
+
options: options)
|
90
|
+
end
|
91
|
+
|
92
|
+
# Public: Response for /investments/holdings/get.
|
93
|
+
class GetResponse < Models::BaseResponse
|
94
|
+
##
|
95
|
+
# :attr_reader:
|
96
|
+
# Public: The item: Plaid::Models::Item.
|
97
|
+
property :item, coerce: Models::Item
|
98
|
+
|
99
|
+
##
|
100
|
+
# :attr_reader:
|
101
|
+
# Public: The list of accounts: Array of Plaid::Models::Account.
|
102
|
+
property :accounts, coerce: Array[Models::Account]
|
103
|
+
|
104
|
+
##
|
105
|
+
# :attr_reader:
|
106
|
+
# Public: The list of holdings: Array of Plaid::Models::Holding.
|
107
|
+
property :holdings, coerce: Array[Models::Holding]
|
108
|
+
|
109
|
+
##
|
110
|
+
# :attr_reader:
|
111
|
+
# Public: The list of securities referenced by the holdings: Array of
|
112
|
+
# Plaid::Models::Security.
|
113
|
+
property :securities, coerce: Array[Models::Security]
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# Public: Class used to call the Accounts product.
|
118
|
+
class Investments < BaseProduct
|
119
|
+
##
|
120
|
+
# Public: The Plaid::InvestmentTransactions product accessor.
|
121
|
+
subproduct :transactions, Plaid::InvestmentTransactions
|
122
|
+
|
123
|
+
##
|
124
|
+
# Public: The Plaid::Holdings product accessor.
|
125
|
+
subproduct :holdings
|
126
|
+
end
|
127
|
+
end
|
data/lib/plaid/products/item.rb
CHANGED
@@ -53,34 +53,6 @@ module Plaid
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
# Public: Class used to call the Credentials sub-product.
|
57
|
-
class Credentials < BaseProduct
|
58
|
-
# Public: Update credentials for an access_token.
|
59
|
-
#
|
60
|
-
# Does a POST /item/credentials/update call which is used to update
|
61
|
-
# credentials if the credentials become no longer valid.
|
62
|
-
#
|
63
|
-
# access_token - access_token who's item to update credentials for
|
64
|
-
# credentials - New credentials
|
65
|
-
#
|
66
|
-
# Returns an UpdateResponse object with either an ItemStatus or MFA
|
67
|
-
# response.
|
68
|
-
def update(access_token, credentials)
|
69
|
-
post_with_auth 'item/credentials/update',
|
70
|
-
UpdateResponse,
|
71
|
-
access_token: access_token,
|
72
|
-
credentials: credentials
|
73
|
-
end
|
74
|
-
|
75
|
-
# Public: Response for /item/credentials/update.
|
76
|
-
class UpdateResponse < Models::BaseResponse
|
77
|
-
##
|
78
|
-
# :attr_reader:
|
79
|
-
# Public: The item: Plaid::Models::Item.
|
80
|
-
property :item, coerce: Models::Item
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
56
|
# Public: Class used to call the PublicToken sub-product
|
85
57
|
class PublicToken < BaseProduct
|
86
58
|
# Public: Creates a public token from an access_token.
|
@@ -175,11 +147,6 @@ module Plaid
|
|
175
147
|
# Public: The Plaid::AccessToken product accessor.
|
176
148
|
subproduct :access_token
|
177
149
|
|
178
|
-
##
|
179
|
-
# :attr_reader:
|
180
|
-
# Public: The Plaid::Credentials product accessor.
|
181
|
-
subproduct :credentials
|
182
|
-
|
183
150
|
##
|
184
151
|
# :attr_reader:
|
185
152
|
# Public: The Plaid::PublicToken product accessor.
|
@@ -190,127 +157,6 @@ module Plaid
|
|
190
157
|
# Public: The Plaid::Webhook product accessor.
|
191
158
|
subproduct :webhook
|
192
159
|
|
193
|
-
# Public: Creates an item.
|
194
|
-
#
|
195
|
-
# Does a POST /item/create call which attemps to create a new item for you
|
196
|
-
# possibly returning a success, error, or multi-factor authentication
|
197
|
-
# response.
|
198
|
-
#
|
199
|
-
# credentials - Institution credentials to create item with.
|
200
|
-
# institution_id - Institution ID to create item with.
|
201
|
-
# initial_products - Initial products to create the item with,
|
202
|
-
# i.e. [:transactions].
|
203
|
-
# transactions_start_date - date at which to begin the item's initial
|
204
|
-
# transaction pull (optional).
|
205
|
-
# transactions_end_date - date at which to end the item's initial
|
206
|
-
# transaction pull (optional).
|
207
|
-
# transactions_await_results - if true, the initial transaction pull will
|
208
|
-
# be performed synchronously (optional).
|
209
|
-
# webhook - webhook to associate with the item
|
210
|
-
# (optional).
|
211
|
-
# options - Additional options to merge into API
|
212
|
-
# request.
|
213
|
-
#
|
214
|
-
# Returns an ItemResponse object with item info including access_token and
|
215
|
-
# ItemStatus, or MFA response or error.
|
216
|
-
def create(credentials:,
|
217
|
-
institution_id:,
|
218
|
-
initial_products:,
|
219
|
-
transactions_start_date: nil,
|
220
|
-
transactions_end_date: nil,
|
221
|
-
transactions_await_results: nil,
|
222
|
-
webhook: nil,
|
223
|
-
options: nil)
|
224
|
-
|
225
|
-
options_payload = {}
|
226
|
-
|
227
|
-
txn_options = transaction_options transactions_start_date,
|
228
|
-
transactions_end_date,
|
229
|
-
transactions_await_results
|
230
|
-
|
231
|
-
options_payload[:transactions] = txn_options if txn_options != {}
|
232
|
-
options_payload[:webhook] = webhook unless webhook.nil?
|
233
|
-
options_payload = options_payload.merge(options) unless options.nil?
|
234
|
-
|
235
|
-
post_with_auth 'item/create',
|
236
|
-
ItemResponse,
|
237
|
-
credentials: credentials,
|
238
|
-
institution_id: institution_id,
|
239
|
-
initial_products: initial_products,
|
240
|
-
options: options_payload
|
241
|
-
end
|
242
|
-
|
243
|
-
private def transaction_options(start_date, end_date, await_results)
|
244
|
-
{}.tap do |options|
|
245
|
-
options[:start_date] = Plaid.convert_to_date_string(start_date) \
|
246
|
-
if start_date
|
247
|
-
|
248
|
-
options[:end_date] = Plaid.convert_to_date_string(end_date) \
|
249
|
-
if end_date
|
250
|
-
|
251
|
-
options[:await_results] = await_results if await_results
|
252
|
-
end
|
253
|
-
end
|
254
|
-
|
255
|
-
# Public: Response for /item/create and /item/mfa endpoints.
|
256
|
-
class ItemResponse < Models::BaseResponse
|
257
|
-
##
|
258
|
-
# :attr_reader:
|
259
|
-
# Public: The String access_token to use with API.
|
260
|
-
property :access_token
|
261
|
-
|
262
|
-
##
|
263
|
-
# :attr_reader:
|
264
|
-
# Public: The Plaid::Models::Item object, returned if item has been
|
265
|
-
# successfully created.
|
266
|
-
property :item, coerce: Models::Item
|
267
|
-
|
268
|
-
##
|
269
|
-
# :attr_reader:
|
270
|
-
# Public: The MFA/OTP device information: Plaid::Models::MFA::Device.
|
271
|
-
property :device, coerce: Models::MFA::Device
|
272
|
-
|
273
|
-
##
|
274
|
-
# :attr_reader:
|
275
|
-
# Public: The list of devices to send the OTP to:
|
276
|
-
# Array of Plaid::Models::MFA::DeviceListElement.
|
277
|
-
property :device_list, coerce: Array[Models::MFA::DeviceListElement]
|
278
|
-
|
279
|
-
##
|
280
|
-
# :attr_reader:
|
281
|
-
# Public: The String MFA type. E.g. "device_list", "device", "questions",
|
282
|
-
# "selections".
|
283
|
-
property :mfa_type
|
284
|
-
|
285
|
-
##
|
286
|
-
# :attr_reader:
|
287
|
-
# Public: The Array of String MFA questions.
|
288
|
-
property :questions
|
289
|
-
|
290
|
-
##
|
291
|
-
# :attr_reader:
|
292
|
-
# Public: The Array of MFA selections: Plaid::Models::MFA::Selection.
|
293
|
-
property :selections, coerce: Array[Models::MFA::Selection]
|
294
|
-
end
|
295
|
-
|
296
|
-
# Public: Submit an MFA step.
|
297
|
-
#
|
298
|
-
# Does a POST /item/mfa call which gives you the ability to respond to an
|
299
|
-
# MFA.
|
300
|
-
#
|
301
|
-
# access_token - To submit MFA step for.
|
302
|
-
# mfa_type - The MFA type indicated in the MFA response.
|
303
|
-
# responses - List of answers/responses to MFA.
|
304
|
-
#
|
305
|
-
# Returns an ItemResponse instance.
|
306
|
-
def mfa(access_token, mfa_type, responses)
|
307
|
-
post_with_auth 'item/mfa',
|
308
|
-
ItemResponse,
|
309
|
-
access_token: access_token,
|
310
|
-
mfa_type: mfa_type,
|
311
|
-
responses: responses
|
312
|
-
end
|
313
|
-
|
314
160
|
# Public: Get information about an item.
|
315
161
|
#
|
316
162
|
# Does a POST /item/get call which returns information about an item or
|
@@ -62,11 +62,16 @@ module Plaid
|
|
62
62
|
# Returns a SandboxCreateResponse object with a public token and item id.
|
63
63
|
def create(institution_id:,
|
64
64
|
initial_products:,
|
65
|
+
transactions_start_date: nil,
|
66
|
+
transactions_end_date: nil,
|
65
67
|
webhook: nil,
|
66
68
|
options: nil)
|
67
69
|
|
68
70
|
options_payload = {}
|
69
71
|
options_payload[:webhook] = webhook unless webhook.nil?
|
72
|
+
txn_options = transaction_options transactions_start_date,
|
73
|
+
transactions_end_date
|
74
|
+
options_payload[:transactions] = txn_options if txn_options != {}
|
70
75
|
options_payload = options_payload.merge(options) unless options.nil?
|
71
76
|
|
72
77
|
post_with_public_key 'sandbox/public_token/create',
|
@@ -76,6 +81,16 @@ module Plaid
|
|
76
81
|
options: options_payload
|
77
82
|
end
|
78
83
|
|
84
|
+
private def transaction_options(start_date, end_date)
|
85
|
+
{}.tap do |options|
|
86
|
+
options[:start_date] = Plaid.convert_to_date_string(start_date) \
|
87
|
+
if start_date
|
88
|
+
|
89
|
+
options[:end_date] = Plaid.convert_to_date_string(end_date) \
|
90
|
+
if end_date
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
79
94
|
# Public: Response for /sandbox/public_token/create.
|
80
95
|
class SandboxCreateResponse < Models::BaseResponse
|
81
96
|
##
|
data/lib/plaid/version.rb
CHANGED
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: 8.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: 2019-
|
11
|
+
date: 2019-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -200,6 +200,7 @@ files:
|
|
200
200
|
- lib/plaid/products/identity.rb
|
201
201
|
- lib/plaid/products/income.rb
|
202
202
|
- lib/plaid/products/institutions.rb
|
203
|
+
- lib/plaid/products/investments.rb
|
203
204
|
- lib/plaid/products/item.rb
|
204
205
|
- lib/plaid/products/processor.rb
|
205
206
|
- lib/plaid/products/sandbox.rb
|