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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d580ca9d22620a9b9013ffd9ef8a0efd16b3c20d
4
- data.tar.gz: 4573253cd4f4505930e40fc01681264cd1c1338a
3
+ metadata.gz: e63a5e82103ca0105e84c8a31da9f6173bf57a65
4
+ data.tar.gz: ef0c902d7550475b3a8b8890a7c29d8b0c984755
5
5
  SHA512:
6
- metadata.gz: c67ea7aa96ca28bb546d4eec39598de2d9ee99e56026e1d2608cde31e0378015b8142a508160331baba85423e4bff2d1b5369db3daeaf4220d7bb445d9af2929
7
- data.tar.gz: cc9889686d916cb705378db8329629ccc5549986a90cf03320a570ea368b8d2b890dd593725b93d3f0639c19485da91f4d1c40591fea311ec39b456996353166
6
+ metadata.gz: b7bd8d82316fb38d8c35ec1b5158fa3111b507a6c06add78a24eba8b8afde850562de821f7326936f2123310338d4e25794ab04807a16ed1b69cec9a512ee5ae
7
+ data.tar.gz: f42b8eee5ea2df7b2761ef1c2c03207e65f28717ce4882a7ec2f94e05c77d7cca0c936fa1635d77f6192a3b586939ef8a0fa7a966a7dad5698c0c2a27ddb66f6
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- plaider (0.1.2)
4
+ plaider (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -7,8 +7,7 @@ module Plaider
7
7
  include Plaider::Configurable
8
8
 
9
9
  def scope(access_token = nil)
10
- if !defined?(@access_token) || @access_token != access_token
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
@@ -4,7 +4,8 @@ require 'json'
4
4
  module Plaider
5
5
  class Client
6
6
 
7
- BASE_URL = 'https://tartan.plaid.com'
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(BASE_URL)
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
@@ -1,7 +1,7 @@
1
1
  module Plaider
2
2
  module Configurable
3
3
 
4
- KEYS = [:client_id, :secret, :access_token, :open_timeout, :read_timeout]
4
+ KEYS = [:client_id, :secret, :access_token, :environment, :open_timeout, :read_timeout, :verbose]
5
5
 
6
6
  attr_writer *KEYS
7
7
 
@@ -1,3 +1,3 @@
1
1
  module Plaider
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
@@ -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
@@ -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::BASE_URL + path)
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::BASE_URL + path)
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::BASE_URL + path)
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::BASE_URL + path)
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::BASE_URL + path)
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.2
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-05 00:00:00.000000000 Z
11
+ date: 2014-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler