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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f39ff944ff6e3e21b2fa3262ef463095349c1491
4
- data.tar.gz: 269f0c0a4e6bed37a2ccd57a27ffbcb8efe61d9f
3
+ metadata.gz: 63fc4c6d5edc540a08bf732fd0d42f85a04ab1e1
4
+ data.tar.gz: 48358423aa4b643c3d6af4559468c257cf262ad4
5
5
  SHA512:
6
- metadata.gz: 418b1c53390a1eb298a147e6edaae0943f24d11cdcc8b601a1b69a78302d1685778316c53d1c04cd983a364f31fe3bba85d2ef6f47a67bc57e556a40fdfde4d3
7
- data.tar.gz: f0641d4ee4df67b075c82cf4f61710f31e9ff36a37fc4509a6408637b920768e15df8a4ea5ee4c8c6e9d74c227ff6884d8a17d9d99efbe3add3b79e4ac1133cd
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.1**
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'
@@ -12,7 +12,8 @@ module Plaid
12
12
  end
13
13
  end
14
14
 
15
- def set_user(token,api_level=[])
15
+ def set_user(token,api_level=[],type=nil)
16
+ token = token + '_' + type unless type.nil?
16
17
  begin
17
18
  self.existing_user(token,api_level)
18
19
  rescue => e
@@ -57,7 +57,7 @@ module Plaid
57
57
 
58
58
  def get_info
59
59
  if self.permissions.include? 'info'
60
- res = Plaid.get('info',{access_token:self.access_token})
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
@@ -1,3 +1,3 @@
1
1
  module Plaid
2
- VERSION = '1.4.1'
2
+ VERSION = '1.4.2'
3
3
  end
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('test',['connect'])
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('test',['auth'])
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('test',['info'])
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('test',['connect','info','auth'])
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,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plaid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Crites