plaider 0.1.2 → 0.1.3
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/Gemfile.lock +1 -1
- data/lib/plaider.rb +1 -2
- data/lib/plaider/client.rb +9 -4
- data/lib/plaider/configurable.rb +1 -1
- data/lib/plaider/version.rb +1 -1
- data/test/plaider/plaider_test.rb +4 -0
- data/test/test_helper.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e63a5e82103ca0105e84c8a31da9f6173bf57a65
|
4
|
+
data.tar.gz: ef0c902d7550475b3a8b8890a7c29d8b0c984755
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7bd8d82316fb38d8c35ec1b5158fa3111b507a6c06add78a24eba8b8afde850562de821f7326936f2123310338d4e25794ab04807a16ed1b69cec9a512ee5ae
|
7
|
+
data.tar.gz: f42b8eee5ea2df7b2761ef1c2c03207e65f28717ce4882a7ec2f94e05c77d7cca0c936fa1635d77f6192a3b586939ef8a0fa7a966a7dad5698c0c2a27ddb66f6
|
data/Gemfile.lock
CHANGED
data/lib/plaider.rb
CHANGED
@@ -7,8 +7,7 @@ module Plaider
|
|
7
7
|
include Plaider::Configurable
|
8
8
|
|
9
9
|
def scope(access_token = nil)
|
10
|
-
if !defined?(@
|
11
|
-
@access_token = access_token
|
10
|
+
if !defined?(@client) || @client.access_token != access_token
|
12
11
|
@client = Plaider::Client.new(options.merge({access_token: access_token}))
|
13
12
|
end
|
14
13
|
@client
|
data/lib/plaider/client.rb
CHANGED
@@ -4,7 +4,8 @@ require 'json'
|
|
4
4
|
module Plaider
|
5
5
|
class Client
|
6
6
|
|
7
|
-
|
7
|
+
DEV_BASE_URL = 'https://tartan.plaid.com'
|
8
|
+
PROD_BASE_URL = 'https://api.plaid.com'
|
8
9
|
|
9
10
|
DATE_FORMAT = '%Y-%m-%d'
|
10
11
|
|
@@ -49,7 +50,7 @@ module Plaider
|
|
49
50
|
|
50
51
|
def add_user(institution_type, username, password, email)
|
51
52
|
validate(institution_type: institution_type, username: username, password: password, email: email)
|
52
|
-
response = post('/connect', {type: institution_type, username: username, password: password, email: email})
|
53
|
+
response = post('/connect', {type: institution_type, username: username, password: password, email: email, login_only: true})
|
53
54
|
status_code = response[:status_code].to_i
|
54
55
|
@access_token = response[:result][:access_token] if [200, 201].include?(status_code)
|
55
56
|
response
|
@@ -80,6 +81,10 @@ module Plaider
|
|
80
81
|
response
|
81
82
|
end
|
82
83
|
|
84
|
+
def access_token
|
85
|
+
@access_token
|
86
|
+
end
|
87
|
+
|
83
88
|
protected
|
84
89
|
|
85
90
|
def get(path)
|
@@ -105,7 +110,6 @@ module Plaider
|
|
105
110
|
def delete(path)
|
106
111
|
request = Net::HTTP::Delete.new(path)
|
107
112
|
request.set_form_data(credentials.merge(access_token: @access_token)) if !!@access_token
|
108
|
-
puts request.inspect
|
109
113
|
process(request)
|
110
114
|
end
|
111
115
|
|
@@ -125,10 +129,11 @@ module Plaider
|
|
125
129
|
|
126
130
|
def http
|
127
131
|
unless defined?(@http)
|
128
|
-
uri = URI.parse(
|
132
|
+
uri = URI.parse(@environment == 'production' ? PROD_BASE_URL : DEV_BASE_URL)
|
129
133
|
@http = Net::HTTP.new(uri.host, uri.port)
|
130
134
|
@http.use_ssl = true
|
131
135
|
@http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
136
|
+
@http.set_debug_output($stdout) if @verbose
|
132
137
|
end
|
133
138
|
@http
|
134
139
|
end
|
data/lib/plaider/configurable.rb
CHANGED
data/lib/plaider/version.rb
CHANGED
@@ -15,12 +15,16 @@ class PlaiderTest < Test::Unit::TestCase
|
|
15
15
|
config.access_token = 'access_token'
|
16
16
|
config.open_timeout = 5
|
17
17
|
config.read_timeout = 30
|
18
|
+
config.verbose = true
|
19
|
+
config.environment = 'development'
|
18
20
|
end
|
19
21
|
assert_equal 'client_id', configurable.instance_variable_get(:'@client_id')
|
20
22
|
assert_equal 'secret', configurable.instance_variable_get(:'@secret')
|
21
23
|
assert_equal 'access_token', configurable.instance_variable_get(:'@access_token')
|
24
|
+
assert_equal 'development', configurable.instance_variable_get(:'@environment')
|
22
25
|
assert_equal 5, configurable.instance_variable_get(:'@open_timeout')
|
23
26
|
assert_equal 30, configurable.instance_variable_get(:'@read_timeout')
|
27
|
+
assert_equal true, configurable.instance_variable_get(:'@verbose')
|
24
28
|
end
|
25
29
|
|
26
30
|
def test_scope
|
data/test/test_helper.rb
CHANGED
@@ -18,23 +18,23 @@ require 'plaider'
|
|
18
18
|
WebMock.disable_net_connect!(allow: 'coveralls.io')
|
19
19
|
|
20
20
|
def stub_delete(path)
|
21
|
-
stub_request(:delete, Plaider::Client::
|
21
|
+
stub_request(:delete, Plaider::Client::DEV_BASE_URL + path)
|
22
22
|
end
|
23
23
|
|
24
24
|
def stub_get(path)
|
25
|
-
stub_request(:get, Plaider::Client::
|
25
|
+
stub_request(:get, Plaider::Client::DEV_BASE_URL + path)
|
26
26
|
end
|
27
27
|
|
28
28
|
def stub_post(path)
|
29
|
-
stub_request(:post, Plaider::Client::
|
29
|
+
stub_request(:post, Plaider::Client::DEV_BASE_URL + path)
|
30
30
|
end
|
31
31
|
|
32
32
|
def stub_put(path)
|
33
|
-
stub_request(:put, Plaider::Client::
|
33
|
+
stub_request(:put, Plaider::Client::DEV_BASE_URL + path)
|
34
34
|
end
|
35
35
|
|
36
36
|
def stub_patch(path)
|
37
|
-
stub_request(:patch, Plaider::Client::
|
37
|
+
stub_request(:patch, Plaider::Client::DEV_BASE_URL + path)
|
38
38
|
end
|
39
39
|
|
40
40
|
def fixture_path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plaider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gene Drabkin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|