plaid 1.4.3 → 1.5.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/README.md +66 -2
- data/lib/plaid/config.rb +8 -2
- data/lib/plaid/connection.rb +121 -0
- data/lib/plaid/models/account.rb +24 -0
- data/lib/plaid/models/category.rb +17 -0
- data/lib/plaid/models/exchange_token_response.rb +9 -0
- data/lib/plaid/models/info.rb +12 -0
- data/lib/plaid/models/institution.rb +20 -0
- data/lib/plaid/models/transaction.rb +23 -0
- data/lib/plaid/models/user.rb +192 -0
- data/lib/plaid/version.rb +1 -1
- data/lib/plaid.rb +77 -35
- data/plaid.gemspec +3 -1
- data/spec/account_spec.rb +35 -0
- data/spec/category_spec.rb +5 -14
- data/spec/config_spec.rb +57 -28
- data/spec/institution_spec.rb +6 -14
- data/spec/plaid_spec.rb +258 -0
- data/spec/spec_helper.rb +8 -1
- data/spec/transaction_spec.rb +30 -0
- data/spec/user_spec.rb +98 -109
- metadata +44 -12
- data/lib/plaid/add_user.rb +0 -24
- data/lib/plaid/category/category.rb +0 -29
- data/lib/plaid/institution/institution.rb +0 -29
- data/lib/plaid/user/account/account.rb +0 -35
- data/lib/plaid/user/info/info.rb +0 -23
- data/lib/plaid/user/transaction/transaction.rb +0 -19
- data/lib/plaid/user/user.rb +0 -173
- data/lib/plaid/util.rb +0 -120
- data/spec/add_user_spec.rb +0 -113
data/spec/user_spec.rb
CHANGED
@@ -1,186 +1,175 @@
|
|
1
1
|
require 'spec_helper.rb'
|
2
|
-
########## Plaid instantiated user specs ##########
|
3
|
-
describe '#User' do
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
3
|
+
RSpec.describe Plaid::User do
|
4
|
+
let(:auth_user) { Plaid.add_user('auth', 'plaid_test', 'plaid_good', 'wells') }
|
5
|
+
let(:connect_user) { Plaid.add_user('connect','plaid_test', 'plaid_good', 'wells') }
|
6
|
+
let(:info_user) { Plaid.add_user('info', 'plaid_test', 'plaid_good', 'wells') }
|
10
7
|
|
11
|
-
|
8
|
+
context 'user vars' do
|
12
9
|
|
13
10
|
context 'valid user has accounts and accounts contain id attribute' do
|
14
|
-
user
|
15
|
-
it { expect(user.accounts.first.id).
|
11
|
+
let(:user) { Plaid.add_user('connect','plaid_test','plaid_good','wells') }
|
12
|
+
it { expect(user.accounts.first.id).not_to be_nil }
|
16
13
|
end
|
17
14
|
|
18
15
|
context 'valid user has accounts and accounts contain type attribute' do
|
19
|
-
user
|
16
|
+
let(:user) { Plaid.add_user('connect','plaid_test','plaid_good','wells') }
|
20
17
|
it { expect(user.accounts.first.type).to eq('depository') }
|
21
18
|
end
|
22
|
-
|
23
|
-
context 'gets a valid user with accounts and transactions' do
|
24
|
-
user = Plaid.set_user('test_wells',['connect'])
|
25
|
-
it{ expect(user.transactions).to be_truthy}
|
26
|
-
end
|
27
|
-
|
28
|
-
context 'gets a valid user with accounts' do
|
29
|
-
user = Plaid.set_user('test_wells',['auth'])
|
30
|
-
it{ expect(user.accounts).to be_truthy}
|
31
|
-
end
|
32
|
-
|
33
|
-
#TODO: Fully vet the info api endpoint for the beta functions before adding this as a supported function.
|
34
|
-
=begin
|
35
|
-
context 'gets a valid user with info' do
|
36
|
-
user = Plaid.set_user('test_wells',['info'])
|
37
|
-
it{ expect(user.accounts).to be_truthy}
|
38
|
-
end
|
39
|
-
|
40
|
-
|
41
|
-
context 'gets a fully validated user with all access granted' do
|
42
|
-
user = Plaid.set_user('test_wells',['connect','info','auth'])
|
43
|
-
it{ expect(user.transactions).to be_truthy}
|
44
|
-
end
|
45
|
-
=end
|
46
|
-
|
47
19
|
end
|
48
20
|
|
49
21
|
# MFA specs - after user is instantiated,
|
50
22
|
describe '#mfa_authentication' do
|
23
|
+
let(:user) { Plaid.add_user('connect','plaid_test', 'plaid_good','bofa') }
|
24
|
+
let(:new_mfa_user) { user.mfa_authentication('tomato') }
|
51
25
|
|
52
26
|
context 'enters correct credentials for MFA auth and authenticates' do
|
53
|
-
|
54
|
-
new_mfa_user.mfa_authentication('tomato')
|
55
|
-
it { expect(new_mfa_user.accounts).to be_truthy }
|
27
|
+
it { expect(new_mfa_user.accounts).not_to be_empty }
|
56
28
|
end
|
57
29
|
|
58
30
|
context 'enters old method of adding type strongly in each method and authenticates correctly using 2FA' do
|
59
|
-
new_mfa_user
|
60
|
-
new_mfa_user.mfa_authentication('tomato','bofa')
|
31
|
+
let(:new_mfa_user) { user.mfa_authentication('tomato', 'bofa') }
|
61
32
|
it { expect(new_mfa_user.accounts).to be_truthy }
|
62
33
|
end
|
63
34
|
|
64
35
|
context 'has to enter another round of MFA credentials' do
|
65
|
-
mfa_again
|
66
|
-
mfa_again.mfa_authentication('again')
|
36
|
+
let(:mfa_again) { user.mfa_authentication('again') }
|
67
37
|
it { expect(mfa_again.api_res).to eq 'Requires further authentication' }
|
68
38
|
end
|
69
39
|
|
70
40
|
context 'enters incorrect credentials for MFA auth' do
|
71
|
-
mfa_user
|
72
|
-
mfa_user.
|
73
|
-
|
74
|
-
it { expect { mfa_user.mfa_authentication('bad') }.to raise_error }
|
41
|
+
let(:mfa_user) { user.mfa_authentication('tomato') }
|
42
|
+
let(:mfa_bad) { mfa_user; Plaid.add_user('connect','plaid_test', 'plaid_good','bofa') }
|
43
|
+
it { expect { mfa_bad.mfa_authentication('bad') }.to raise_error }
|
75
44
|
end
|
76
45
|
|
77
46
|
context 'requests list of MFA credentials' do
|
78
|
-
new_mfa_user
|
79
|
-
|
47
|
+
let(:new_mfa_user) { Plaid.add_user('auth', 'plaid_test', 'plaid_good', 'chase', nil, '{"list":true}') }
|
48
|
+
let(:expected_questions) do
|
49
|
+
{
|
50
|
+
"type"=>"list",
|
51
|
+
"mfa"=> [
|
52
|
+
{"mask"=>"xxx-xxx-5309", "type"=>"phone"},
|
53
|
+
{"mask"=>"t..t@plaid.com", "type"=>"email"}
|
54
|
+
],
|
55
|
+
"access_token"=>"test_chase"
|
56
|
+
}
|
57
|
+
end
|
58
|
+
it { expect(new_mfa_user.pending_mfa_questions).to eql(expected_questions) }
|
80
59
|
end
|
81
60
|
|
82
61
|
context 'selects MFA method and returns successful response' do
|
83
|
-
|
84
|
-
new_mfa_user.select_mfa_method({mask:'xxx-xxx-5309'},'chase')
|
85
|
-
|
62
|
+
let(:user) { Plaid.add_user('auth','plaid_test','plaid_good','chase',nil,'{"list":true}') }
|
63
|
+
let(:new_mfa_user) { user.select_mfa_method({mask: 'xxx-xxx-5309' }, 'chase') }
|
64
|
+
let(:expected_pending_questions) do
|
65
|
+
{
|
66
|
+
"type" => "device",
|
67
|
+
"mfa" => { "message" => "Code sent to xxx-xxx-5309" },
|
68
|
+
"access_token" => "test_chase"
|
69
|
+
}
|
70
|
+
end
|
71
|
+
it { expect(new_mfa_user.pending_mfa_questions).to eql(expected_pending_questions) }
|
86
72
|
end
|
87
73
|
|
88
74
|
context 'selects MFA method, and delivers correct payload to authenticate user' do
|
89
|
-
|
90
|
-
|
91
|
-
new_mfa_user.mfa_authentication(1234)
|
92
|
-
it { expect(new_mfa_user.accounts).to be_truthy }
|
93
|
-
end
|
94
|
-
end
|
75
|
+
let(:user) { Plaid.add_user('auth','plaid_test','plaid_good','chase',nil,'{"list":true}') }
|
76
|
+
let(:user_select_method) { user.select_mfa_method({mask:'xxx-xxx-5309'}) }
|
77
|
+
let(:new_mfa_user) { user_select_method.mfa_authentication(1234) }
|
95
78
|
|
96
|
-
|
97
|
-
describe '#get_auth' do
|
98
|
-
auth_user = Plaid.add_user('auth','plaid_test','plaid_good','wells')
|
99
|
-
connect_user = Plaid.add_user('connect','plaid_test','plaid_good','wells')
|
100
|
-
|
101
|
-
context 'has access and returns accounts' do
|
102
|
-
it { expect(auth_user.permissions[0]).to eq('auth') }
|
103
|
-
end
|
104
|
-
|
105
|
-
context 'does not have access to auth' do
|
106
|
-
it{ expect(connect_user.permissions.include? 'auth' ).to be false }
|
79
|
+
it { expect(new_mfa_user.accounts).not_to be_empty }
|
107
80
|
end
|
108
81
|
end
|
109
82
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
connect_user = Plaid.add_user('connect','plaid_test','plaid_good','wells')
|
83
|
+
context 'when authenticating' do
|
84
|
+
# Auth specs
|
85
|
+
describe '#get_auth' do
|
114
86
|
|
115
|
-
|
116
|
-
|
117
|
-
|
87
|
+
context 'has access and returns accounts' do
|
88
|
+
it { expect(auth_user.permissions[0]).to eq('auth') }
|
89
|
+
end
|
118
90
|
|
119
|
-
|
120
|
-
|
91
|
+
context 'does not have access to auth' do
|
92
|
+
it { expect(connect_user.permissions.include? 'auth' ).to eql(false) }
|
93
|
+
end
|
121
94
|
end
|
122
|
-
end
|
123
95
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
96
|
+
# Connect specs
|
97
|
+
describe '#get_connect' do
|
98
|
+
context 'has access and returns accounts' do
|
99
|
+
it { expect(connect_user.permissions[0]).to eq('connect') }
|
100
|
+
end
|
128
101
|
|
129
|
-
|
130
|
-
|
102
|
+
context 'does not have access to auth' do
|
103
|
+
it { expect(auth_user.permissions.include? 'connect' ).to eql(false) }
|
104
|
+
end
|
131
105
|
end
|
132
106
|
|
133
|
-
|
134
|
-
|
107
|
+
# Get info specs
|
108
|
+
describe '#get_info' do
|
109
|
+
context 'has access and returns user info' do
|
110
|
+
it { expect(info_user.permissions[0]).to eq('info') }
|
111
|
+
end
|
112
|
+
|
113
|
+
context 'does not have access to info' do
|
114
|
+
it{ expect(auth_user.permissions.include? 'info' ).to eql(false) }
|
115
|
+
end
|
135
116
|
end
|
136
117
|
end
|
137
118
|
|
138
119
|
describe '#get_balance' do
|
139
|
-
|
140
|
-
user.
|
120
|
+
subject { user.tap(&:update_balance) }
|
121
|
+
let(:user) { Plaid.add_user('info','plaid_test','plaid_good','wells') }
|
122
|
+
|
141
123
|
context 'updates user accounts' do
|
142
|
-
it { expect(
|
124
|
+
it { expect(subject.accounts).not_to be_empty }
|
143
125
|
end
|
144
126
|
|
127
|
+
# TODO: This test needs to be rewritten better, such as using #uniq instead of this
|
145
128
|
context 'should not double up accounts or transactions' do
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
129
|
+
let(:total_duplicates) { duplicate_accounts.length + duplicate_transactions.length }
|
130
|
+
let(:duplicate_accounts) { subject.accounts.select {|element| user.accounts.count(element) > 1} }
|
131
|
+
let(:duplicate_transactions) { subject.transactions.select {|element| user.transactions.count(element) > 1} }
|
132
|
+
it{ expect(total_duplicates).to eql(0) }
|
151
133
|
end
|
134
|
+
end
|
152
135
|
|
153
|
-
=begin TODO: This test needs to pass, currently test credentials are failing
|
154
136
|
describe '#update_info' do
|
155
|
-
info_user
|
137
|
+
let(:info_user) { Plaid.add_user('info', 'plaid_test', 'plaid_good', 'wells') }
|
156
138
|
context 'updates information correctly' do
|
157
|
-
|
139
|
+
# TODO: This test needs to pass, currently test credentials are failing
|
140
|
+
pending { expect { info_user.update_info('plaid_test','plaid_good') }.to_not raise_error }
|
158
141
|
end
|
159
142
|
end
|
160
|
-
=end
|
161
143
|
|
162
144
|
describe '#delete_user' do
|
163
|
-
|
164
|
-
info_user.
|
145
|
+
subject { info_user.tap(&:delete_user) }
|
146
|
+
let(:info_user) { Plaid.add_user('info', 'plaid_test', 'plaid_good', 'wells') }
|
165
147
|
|
166
148
|
context 'updates information correctly' do
|
167
|
-
it { expect {
|
149
|
+
it { expect { subject.get_info }.to raise_error }
|
168
150
|
end
|
169
151
|
end
|
170
152
|
|
171
153
|
describe '#upgrade' do
|
172
|
-
|
173
|
-
|
154
|
+
subject { user.tap(&upgrade!) }
|
155
|
+
let(:upgrade!) { ->(x) { x.upgrade(upgrade_level) } }
|
156
|
+
let(:upgrade_level) { raise 'Define upgrade level' }
|
174
157
|
|
175
158
|
context 'auth upgrade is successful' do
|
176
|
-
|
177
|
-
|
159
|
+
let(:user) { connect_user }
|
160
|
+
let(:upgrade_level) { 'auth' }
|
161
|
+
it { expect{ subject.get_auth }.to_not raise_error }
|
178
162
|
end
|
179
163
|
|
180
164
|
context 'connect upgrade is successful' do
|
181
|
-
|
182
|
-
|
165
|
+
let(:user) { auth_user }
|
166
|
+
let(:upgrade_level) { 'connect' }
|
167
|
+
it { expect{ subject.get_connect }.to_not raise_error }
|
183
168
|
end
|
184
169
|
end
|
185
170
|
|
186
|
-
|
171
|
+
# This stuff needs to be tested and rewritten. Have alredy
|
172
|
+
# surfaced up a bug in it
|
173
|
+
pending "#populate_user"
|
174
|
+
|
175
|
+
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: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Crites
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry-stack_explorer
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
description: Ruby gem wrapper for the Plaid API. Read more at the homepage, the wiki,
|
56
84
|
or the plaid documentation.
|
57
85
|
email:
|
@@ -67,22 +95,24 @@ files:
|
|
67
95
|
- README.md
|
68
96
|
- Rakefile
|
69
97
|
- lib/plaid.rb
|
70
|
-
- lib/plaid/add_user.rb
|
71
|
-
- lib/plaid/category/category.rb
|
72
98
|
- lib/plaid/config.rb
|
73
|
-
- lib/plaid/
|
74
|
-
- lib/plaid/
|
75
|
-
- lib/plaid/
|
76
|
-
- lib/plaid/
|
77
|
-
- lib/plaid/
|
78
|
-
- lib/plaid/
|
99
|
+
- lib/plaid/connection.rb
|
100
|
+
- lib/plaid/models/account.rb
|
101
|
+
- lib/plaid/models/category.rb
|
102
|
+
- lib/plaid/models/exchange_token_response.rb
|
103
|
+
- lib/plaid/models/info.rb
|
104
|
+
- lib/plaid/models/institution.rb
|
105
|
+
- lib/plaid/models/transaction.rb
|
106
|
+
- lib/plaid/models/user.rb
|
79
107
|
- lib/plaid/version.rb
|
80
108
|
- plaid.gemspec
|
81
|
-
- spec/
|
109
|
+
- spec/account_spec.rb
|
82
110
|
- spec/category_spec.rb
|
83
111
|
- spec/config_spec.rb
|
84
112
|
- spec/institution_spec.rb
|
113
|
+
- spec/plaid_spec.rb
|
85
114
|
- spec/spec_helper.rb
|
115
|
+
- spec/transaction_spec.rb
|
86
116
|
- spec/user_spec.rb
|
87
117
|
homepage: https://github.com/plaid/plaid-ruby
|
88
118
|
licenses:
|
@@ -109,9 +139,11 @@ signing_key:
|
|
109
139
|
specification_version: 4
|
110
140
|
summary: Ruby bindings for Plaid
|
111
141
|
test_files:
|
112
|
-
- spec/
|
142
|
+
- spec/account_spec.rb
|
113
143
|
- spec/category_spec.rb
|
114
144
|
- spec/config_spec.rb
|
115
145
|
- spec/institution_spec.rb
|
146
|
+
- spec/plaid_spec.rb
|
116
147
|
- spec/spec_helper.rb
|
148
|
+
- spec/transaction_spec.rb
|
117
149
|
- spec/user_spec.rb
|
data/lib/plaid/add_user.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
module Plaid
|
2
|
-
module AddUser
|
3
|
-
def add_user(api_level,username,password,type,pin=nil,options=nil)
|
4
|
-
begin
|
5
|
-
payload = {username:username,password:password,type:type}
|
6
|
-
payload.merge!(pin:pin) if pin
|
7
|
-
payload.merge!(options: options) if options
|
8
|
-
res = self.post(api_level,payload)
|
9
|
-
self.user(res,api_level)
|
10
|
-
rescue => e
|
11
|
-
error_handler(e)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def set_user(token,api_level=[],type=nil)
|
16
|
-
token = token + '_' + type unless type.nil?
|
17
|
-
begin
|
18
|
-
self.existing_user(token,api_level)
|
19
|
-
rescue => e
|
20
|
-
error_handler(e)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'plaid/util'
|
2
|
-
module Plaid
|
3
|
-
class Category
|
4
|
-
include Plaid::Util
|
5
|
-
|
6
|
-
attr_accessor(:type, :hierarchy, :id, :cat_array)
|
7
|
-
|
8
|
-
def instantiate_all_categories(res)
|
9
|
-
self.cat_array = []
|
10
|
-
res.each do |cat|
|
11
|
-
category = Category.new
|
12
|
-
self.cat_array << category.build_category(cat)
|
13
|
-
end
|
14
|
-
self.cat_array
|
15
|
-
end
|
16
|
-
|
17
|
-
def instantiate_one_category(res)
|
18
|
-
self.build_category(res)
|
19
|
-
self
|
20
|
-
end
|
21
|
-
|
22
|
-
protected
|
23
|
-
|
24
|
-
def build_category(cat)
|
25
|
-
self.type = cat['type'], self.hierarchy = cat['hierarchy'], self.id = cat['id']
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'plaid/util'
|
2
|
-
module Plaid
|
3
|
-
class Institution
|
4
|
-
include Plaid::Util
|
5
|
-
|
6
|
-
attr_accessor(:id, :name, :type, :has_mfa, :mfa, :inst_array)
|
7
|
-
|
8
|
-
def instantiate_all_institutions(res)
|
9
|
-
self.inst_array = []
|
10
|
-
res.each do |inst|
|
11
|
-
institution = Institution.new
|
12
|
-
inst_array << institution.build_institution(inst)
|
13
|
-
end
|
14
|
-
self.inst_array
|
15
|
-
end
|
16
|
-
|
17
|
-
def instantiate_one_institution(res)
|
18
|
-
self.build_institution(res)
|
19
|
-
self
|
20
|
-
end
|
21
|
-
|
22
|
-
protected
|
23
|
-
|
24
|
-
def build_institution(inst)
|
25
|
-
self.id = inst['id'], self.name = inst['name'], self.type = inst['type'], self.has_mfa =inst['has_mfa'], self.mfa = inst['mfa']
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'plaid/util'
|
2
|
-
module Plaid
|
3
|
-
class Account
|
4
|
-
include Plaid::Util
|
5
|
-
# Define vars for user accounts
|
6
|
-
attr_accessor(:available_balance, :current_balance, :institution_type, :meta, :transactions, :numbers, :name, :id, :type)
|
7
|
-
|
8
|
-
# Instantiate a new account with the results of the successful API call
|
9
|
-
# Build an array of nested transactions, and return self if successful
|
10
|
-
def new(res)
|
11
|
-
begin
|
12
|
-
self.name = res['name'], self.available_balance = res['balance']['available'], self.current_balance = res['balance']['current'], self.institution_type = res['institution_type'], self.id = res['_id'], self.type = res['type']
|
13
|
-
self.meta = res['meta'] if res['meta']
|
14
|
-
res['numbers'] ? self.numbers = res['numbers'] : self.numbers = 'Upgrade user to access routing information for this account'
|
15
|
-
rescue => e
|
16
|
-
error_handler(e)
|
17
|
-
else
|
18
|
-
self
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def update_account(res)
|
23
|
-
begin
|
24
|
-
self.name = res['name'], self.available_balance = res['balance']['available'], self.current_balance = res['balance']['current'], self.institution_type = res['institution_type'], self.id = res['_id'], self.type = res['type']
|
25
|
-
self.meta = res['meta'] if res['meta']
|
26
|
-
res['numbers'] ? self.numbers = res['numbers'] : self.numbers = 'Upgrade user to access routing information for this account'
|
27
|
-
rescue => e
|
28
|
-
error_handler(e)
|
29
|
-
else
|
30
|
-
self
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
data/lib/plaid/user/info/info.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'plaid/util'
|
2
|
-
module Plaid
|
3
|
-
class Information
|
4
|
-
include Plaid::Util
|
5
|
-
# Define vars for info
|
6
|
-
attr_accessor(:names, :emails, :phone_numbers, :addresses)
|
7
|
-
|
8
|
-
def new
|
9
|
-
self.names = []
|
10
|
-
self.emails = []
|
11
|
-
self.phone_numbers = []
|
12
|
-
self.addresses = ''
|
13
|
-
end
|
14
|
-
|
15
|
-
def update_info(res)
|
16
|
-
self.names = res['names']
|
17
|
-
self.emails = res['emails']
|
18
|
-
self.phone_numbers = res['phone_numbers']
|
19
|
-
self.addresses = res['addresses']
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'plaid/util'
|
2
|
-
module Plaid
|
3
|
-
class Transaction
|
4
|
-
include Plaid::Util
|
5
|
-
# Define vars for user accounts
|
6
|
-
attr_accessor(:id, :account, :amount, :name, :meta, :location, :pending, :score, :type, :category, :category_id)
|
7
|
-
|
8
|
-
# Instantiate a new account with the results of the successful API call
|
9
|
-
# Build an array of nested transactions, and return self if successful
|
10
|
-
def new(res)
|
11
|
-
begin
|
12
|
-
self.id = res['_id'], self.account = res['_account'], self.amount = res['amount'], self.name = res['name'], self.meta = res['meta'], self.location = res['location'], self.pending = res['pending'], self.score = res['score'], self.type = res['type'], self.category = res['category'], self.category_id = res['category_id']
|
13
|
-
rescue => e
|
14
|
-
error_handler(e)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|