paychex_api 0.0.22 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -8
- data/lib/paychex_api/api_array.rb +12 -2
- data/lib/paychex_api/client.rb +6 -0
- data/lib/paychex_api/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b08cf38b56a279f0e7341aa6dd826cd41deff9b1
|
4
|
+
data.tar.gz: 317ee58d2d600c880c6620cf7803519f5ecbe508
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cac55a46edaa5117c5faa8391b86fb1d0a3ef4d7f9c50312e4b6119363e26d8bd7c1ff1b9d9c2a14b786ad2496692f6c636a7c4649e8d65a7c894c5ed39a4bd9
|
7
|
+
data.tar.gz: 50b4c58dd1ebadcd73673979539439be5384201af7ebb01224468a58bca40896d73be5fc05475a06d80c3e02880fd76a08534d9317d2b9d0ddf37382d967be7c
|
data/Gemfile.lock
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
paychex_api (0.0.
|
4
|
+
paychex_api (0.0.23)
|
5
5
|
faraday (~> 0.9.2)
|
6
|
-
faraday_middleware (
|
6
|
+
faraday_middleware (>= 0.12.2)
|
7
7
|
footrest (>= 0.5.1)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (5.2.
|
12
|
+
activesupport (5.2.3)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 0.7, < 2)
|
15
15
|
minitest (~> 5.1)
|
@@ -19,15 +19,15 @@ GEM
|
|
19
19
|
ast (2.4.0)
|
20
20
|
byebug (8.2.5)
|
21
21
|
coderay (1.1.2)
|
22
|
-
concurrent-ruby (1.
|
22
|
+
concurrent-ruby (1.1.5)
|
23
23
|
crack (0.4.3)
|
24
24
|
safe_yaml (~> 1.0.0)
|
25
25
|
diff-lcs (1.3)
|
26
26
|
docile (1.3.0)
|
27
27
|
faraday (0.9.2)
|
28
28
|
multipart-post (>= 1.2, < 3)
|
29
|
-
faraday_middleware (0.
|
30
|
-
faraday (>= 0.7.4, < 0
|
29
|
+
faraday_middleware (0.13.1)
|
30
|
+
faraday (>= 0.7.4, < 1.0)
|
31
31
|
footrest (0.5.3)
|
32
32
|
activesupport (>= 3.0.0)
|
33
33
|
faraday (>= 0.9.0, < 1)
|
@@ -38,14 +38,14 @@ GEM
|
|
38
38
|
hashdiff (0.3.7)
|
39
39
|
httparty (0.16.2)
|
40
40
|
multi_xml (>= 0.5.2)
|
41
|
-
i18n (1.0
|
41
|
+
i18n (1.6.0)
|
42
42
|
concurrent-ruby (~> 1.0)
|
43
43
|
json (2.1.0)
|
44
44
|
link_header (0.0.8)
|
45
45
|
method_source (0.9.0)
|
46
46
|
minitest (5.11.3)
|
47
47
|
multi_xml (0.6.0)
|
48
|
-
multipart-post (2.
|
48
|
+
multipart-post (2.1.1)
|
49
49
|
parallel (1.12.1)
|
50
50
|
parser (2.5.1.0)
|
51
51
|
ast (~> 2.4.0)
|
@@ -94,14 +94,24 @@ module PaychexAPI
|
|
94
94
|
@members.concat(get_response_content(response))
|
95
95
|
end
|
96
96
|
|
97
|
-
def get_page(url, params = {})
|
97
|
+
def get_page(url, params = {}, tries=0)
|
98
98
|
query = URI.parse(url).query
|
99
99
|
p = CGI.parse(query).merge(params)
|
100
100
|
u = url.gsub("?#{query}", '')
|
101
101
|
p.each { |k, v| p[k] = v.first if v.is_a?(Array) }
|
102
|
-
@api_client.connection.send(:get) do |r|
|
102
|
+
resp = @api_client.connection.send(:get) do |r|
|
103
103
|
r.url(u, p)
|
104
104
|
end
|
105
|
+
tries = 0 if status == 200
|
106
|
+
resp
|
107
|
+
rescue Footrest::HttpError::Unauthorized => e
|
108
|
+
if tries == 0
|
109
|
+
# token may have expired for long running pagination requests, refresh and try again
|
110
|
+
@api_client.refresh_token!
|
111
|
+
get_page(url, params, (tries +1))
|
112
|
+
else
|
113
|
+
raise e
|
114
|
+
end
|
105
115
|
end
|
106
116
|
|
107
117
|
def load_page(url)
|
data/lib/paychex_api/client.rb
CHANGED
@@ -49,6 +49,12 @@ module PaychexAPI
|
|
49
49
|
authorize if @authorization.blank? || @authorization['expiration'] <= Time.now - 30.seconds
|
50
50
|
@authorization['access_token']
|
51
51
|
end
|
52
|
+
|
53
|
+
def refresh_token!
|
54
|
+
config.delete(:token)
|
55
|
+
authorize
|
56
|
+
connection.headers[:authorization] = "Bearer #{token}"
|
57
|
+
end
|
52
58
|
|
53
59
|
def authorize
|
54
60
|
response = faraday_auth.post(
|
data/lib/paychex_api/version.rb
CHANGED
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.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay Shaffer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -287,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
287
287
|
version: '0'
|
288
288
|
requirements: []
|
289
289
|
rubyforge_project:
|
290
|
-
rubygems_version: 2.
|
290
|
+
rubygems_version: 2.6.11
|
291
291
|
signing_key:
|
292
292
|
specification_version: 4
|
293
293
|
summary: Paychex API
|