plaid 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/plaid.rb +2 -1
- data/lib/plaid/add_user.rb +2 -1
- data/lib/plaid/user/user.rb +2 -1
- data/lib/plaid/util.rb +11 -0
- data/lib/plaid/version.rb +1 -1
- data/spec/user_spec.rb +9 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63fc4c6d5edc540a08bf732fd0d42f85a04ab1e1
|
4
|
+
data.tar.gz: 48358423aa4b643c3d6af4559468c257cf262ad4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1210939c88948e6712aadfe7bda081fde1ed7eca97f5c7d21ee28551177f32207d9f4aa761c7b6711fccc5ff76e7ce5401713b905e8d91ff6257ee40aaf8dd88
|
7
|
+
data.tar.gz: fdff039d1be8fb988e83893e058fc65b7b3c3ccf6a3817673aaf373ef83d8ae579fe8ac8a36e7781b1aae82429efea9872ef2e4531bdffa353d3c9f94669af1c
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ Ruby bindings for the Plaid API
|
|
6
6
|
|
7
7
|
This version is a beta version that contains failing tests for the new 'info' endpoint. While these have been tested individually on real accounts the tests here will fail with the test accounts supplied. These will be updated soon with test credentials.
|
8
8
|
|
9
|
-
Latest stable version: **1.4.
|
9
|
+
Latest stable version: **1.4.2**
|
10
10
|
|
11
11
|
This version removes the need to use 'type' in each additional call.
|
12
12
|
|
data/lib/plaid.rb
CHANGED
@@ -24,10 +24,11 @@ module Plaid
|
|
24
24
|
@user.new(res,api_level)
|
25
25
|
end
|
26
26
|
|
27
|
-
def existing_user(token,api_level=[])
|
27
|
+
def existing_user(token,api_level=[],type=nil)
|
28
28
|
@user = Plaid::User.new
|
29
29
|
@user.access_token = token
|
30
30
|
api_level.each { |i|
|
31
|
+
@user.permissions << i
|
31
32
|
@user.get_auth if i == 'auth'
|
32
33
|
@user.get_connect if i == 'connect'
|
33
34
|
@user.get_info if i == 'info'
|
data/lib/plaid/add_user.rb
CHANGED
data/lib/plaid/user/user.rb
CHANGED
@@ -57,7 +57,7 @@ module Plaid
|
|
57
57
|
|
58
58
|
def get_info
|
59
59
|
if self.permissions.include? 'info'
|
60
|
-
res = Plaid.
|
60
|
+
res = Plaid.secure_get('info',self.access_token)
|
61
61
|
build_user(res)
|
62
62
|
else
|
63
63
|
false
|
@@ -69,6 +69,7 @@ module Plaid
|
|
69
69
|
payload = {username:username,password:pass,access_token:self.access_token}
|
70
70
|
payload.merge!({pin:pin}) if pin
|
71
71
|
res = Plaid.patch('info',payload)
|
72
|
+
puts res
|
72
73
|
build_user(res)
|
73
74
|
else
|
74
75
|
false
|
data/lib/plaid/util.rb
CHANGED
@@ -17,6 +17,16 @@ module Plaid
|
|
17
17
|
parse_get_response(res)
|
18
18
|
end
|
19
19
|
|
20
|
+
def secure_get(path,access_token,options={})
|
21
|
+
uri = build_uri(path)
|
22
|
+
options.merge!({access_token:access_token})
|
23
|
+
req = Net::HTTP::Get.new(uri)
|
24
|
+
req.body = URI.encode_www_form(options) if options
|
25
|
+
req.content_type = 'multipart/form-data'
|
26
|
+
res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') { |http| http.request(req) }
|
27
|
+
parse_response(res)
|
28
|
+
end
|
29
|
+
|
20
30
|
def patch(path,options={})
|
21
31
|
uri = build_uri(path)
|
22
32
|
options.merge!({client_id: self.instance_variable_get(:'@customer_id') ,secret: self.instance_variable_get(:'@secret')})
|
@@ -39,6 +49,7 @@ module Plaid
|
|
39
49
|
def error_handler(err,res=nil)
|
40
50
|
case err
|
41
51
|
when 'Bad Request'
|
52
|
+
puts res.body
|
42
53
|
raise 'The request was malformed. Did you check the API docs?'
|
43
54
|
when 'Unauthorized'
|
44
55
|
raise 'Access denied: Try using the correct credentials.'
|
data/lib/plaid/version.rb
CHANGED
data/spec/user_spec.rb
CHANGED
@@ -21,24 +21,29 @@ describe '#User' do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
context 'gets a valid user with accounts and transactions' do
|
24
|
-
user = Plaid.set_user('
|
24
|
+
user = Plaid.set_user('test_wells',['connect'])
|
25
25
|
it{ expect(user.transactions).to be_truthy}
|
26
26
|
end
|
27
27
|
|
28
28
|
context 'gets a valid user with accounts' do
|
29
|
-
user = Plaid.set_user('
|
29
|
+
user = Plaid.set_user('test_wells',['auth'])
|
30
30
|
it{ expect(user.accounts).to be_truthy}
|
31
31
|
end
|
32
32
|
|
33
|
+
#TODO: Fully vet the info api endpoint for the beta functions before adding this as a supported function.
|
34
|
+
=begin
|
33
35
|
context 'gets a valid user with info' do
|
34
|
-
user = Plaid.set_user('
|
36
|
+
user = Plaid.set_user('test_wells',['info'])
|
35
37
|
it{ expect(user.accounts).to be_truthy}
|
36
38
|
end
|
37
39
|
|
40
|
+
|
38
41
|
context 'gets a fully validated user with all access granted' do
|
39
|
-
user = Plaid.set_user('
|
42
|
+
user = Plaid.set_user('test_wells',['connect','info','auth'])
|
40
43
|
it{ expect(user.transactions).to be_truthy}
|
41
44
|
end
|
45
|
+
=end
|
46
|
+
|
42
47
|
end
|
43
48
|
|
44
49
|
# MFA specs - after user is instantiated,
|