paychex_api 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/paychex_api/client.rb +7 -2
- data/lib/paychex_api/version.rb +1 -1
- data/spec/paychex_api/client_spec.rb +8 -0
- 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: 4f6cc355d93296240ca96d8f03e85d0d273c9a03
|
4
|
+
data.tar.gz: 525ff92bfc92af9e7a783ae4dd357621ece75c60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3cccf3d0093111352b6579dd936e48f612a25184a2fc8b45ee50a5c0808179c6a6f59f6d2eb903407870fae54eaf399efbf664533f585a5dd78c6b01db6c520
|
7
|
+
data.tar.gz: 75b812270b3061851d459a37605507b868e8c038c9def755eeed5bafe734ef22670186780d308ecddf8f729605347c949953486355445fb886823fbf66b83513
|
data/Gemfile.lock
CHANGED
data/lib/paychex_api/client.rb
CHANGED
@@ -40,11 +40,16 @@ module PaychexAPI
|
|
40
40
|
|
41
41
|
# Override Footrest request for ApiArray support
|
42
42
|
def request(method, &block)
|
43
|
-
|
44
|
-
connection.headers[:authorization] = "Bearer #{@authorization['access_token']}"
|
43
|
+
connection.headers[:authorization] = "Bearer #{token}"
|
45
44
|
ApiArray.process_response(connection.send(method, &block), self)
|
46
45
|
end
|
47
46
|
|
47
|
+
def token
|
48
|
+
return config[:token] if config[:token].present?
|
49
|
+
authorize if @authorization.blank? || @authorization['expiration'] <= Time.now - 30.seconds
|
50
|
+
@authorization['access_token']
|
51
|
+
end
|
52
|
+
|
48
53
|
def authorize
|
49
54
|
response = faraday_auth.post(
|
50
55
|
OAUTH_TOKEN_PATH,
|
data/lib/paychex_api/version.rb
CHANGED
@@ -23,4 +23,12 @@ describe PaychexAPI::Client do
|
|
23
23
|
@client.get_all_workers('1')
|
24
24
|
expect(@client.connection.headers['Authorization']).to(eq('Bearer 99f9c30a-8134-4a30-a789-7c7665add41e'))
|
25
25
|
end
|
26
|
+
|
27
|
+
it 'should use a token instead of authorization' do
|
28
|
+
client = PaychexAPI::Client.new(
|
29
|
+
prefix: 'https://www.fake.com', client_id: 'client_id', client_secret: 'client_secret', token: '12345'
|
30
|
+
)
|
31
|
+
client.get_all_workers('1')
|
32
|
+
expect(client.connection.headers['Authorization']).to(eq('Bearer 12345'))
|
33
|
+
end
|
26
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paychex_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay Shaffer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|