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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 964b79a9ce34ea9e12a392c4c0eb390a5ff2afdd
4
- data.tar.gz: 97907b01de05f97d3ccddad6ab1e8d4bb47b5890
3
+ metadata.gz: 4f6cc355d93296240ca96d8f03e85d0d273c9a03
4
+ data.tar.gz: 525ff92bfc92af9e7a783ae4dd357621ece75c60
5
5
  SHA512:
6
- metadata.gz: 0fe31f8e7f3e44fc4202158a8a70b55aa73a08122352f60c532bce786dc34eb193370f694e36da296d91ffdaff8f9cdf0a2a43d726632f5590fa0ea0a3ec6053
7
- data.tar.gz: 793c2cf163c2ab9fc415570a1ca088bf1f51545d823136f74edc9688cd6e18c10a8457a6317a347c4f5dd9262b4029b3c48c08a316294cd2956e242bb532840d
6
+ metadata.gz: f3cccf3d0093111352b6579dd936e48f612a25184a2fc8b45ee50a5c0808179c6a6f59f6d2eb903407870fae54eaf399efbf664533f585a5dd78c6b01db6c520
7
+ data.tar.gz: 75b812270b3061851d459a37605507b868e8c038c9def755eeed5bafe734ef22670186780d308ecddf8f729605347c949953486355445fb886823fbf66b83513
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paychex_api (0.0.17)
4
+ paychex_api (0.0.19)
5
5
  faraday (~> 0.9.2)
6
6
  faraday_middleware (~> 0.9.2)
7
7
  footrest (>= 0.5.1)
@@ -40,11 +40,16 @@ module PaychexAPI
40
40
 
41
41
  # Override Footrest request for ApiArray support
42
42
  def request(method, &block)
43
- authorize if @authorization.blank? || @authorization['expiration'] <= Time.now - 30.seconds
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,
@@ -1,3 +1,3 @@
1
1
  module PaychexAPI
2
- VERSION = '0.0.18'.freeze unless defined?(PaychexAPI::VERSION)
2
+ VERSION = '0.0.19'.freeze unless defined?(PaychexAPI::VERSION)
3
3
  end
@@ -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.18
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-08-14 00:00:00.000000000 Z
11
+ date: 2018-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler