paychex 0.3.4 → 0.3.5
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/client/companies.rb +7 -4
- data/lib/paychex/connection.rb +32 -32
- data/lib/paychex/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45e870f2d315996be069c400602a4ccf366a9994cd266618114f6dffc54c9004
|
4
|
+
data.tar.gz: 92f46dee54c5fa14fb1b1b1ff10b7ac4615f57e2cae2eee3ee7dcde9090c7e60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a052c5f5d6ee6811fad22bf8391b302f274fb9fe2d794e21033e3180f8094a7528e79a8230e953b61c1aef239d028adf294ce85a3d13a4c58324664d2efe745f
|
7
|
+
data.tar.gz: 1bf76e48e2e5ed81b69fd055f01f84d5a042f11d9fd93ef7e8dcfe0b124c46458edaac46502e83c503d669e9ce05973d2466e0a9342447167344c7c5eae08a4a
|
data/Gemfile.lock
CHANGED
@@ -12,11 +12,14 @@ module Paychex
|
|
12
12
|
|
13
13
|
begin
|
14
14
|
while response && response.body
|
15
|
-
|
15
|
+
begin
|
16
|
+
companies_count = response.body.fetch('metadata').fetch('pagination').fetch('total')
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
no_of_pages = (companies_count.to_f / limit).ceil
|
19
|
+
rescue KeyError => e
|
20
|
+
# Consider no_of_pages = 1 unless pagination - total node is missing
|
21
|
+
no_of_pages = 1
|
22
|
+
end
|
20
23
|
|
21
24
|
companies_content = response.body.fetch('content').to_a
|
22
25
|
companies_content = companies_content.select { |c| c['hasPermission'] } if companies_content
|
data/lib/paychex/connection.rb
CHANGED
@@ -1,32 +1,32 @@
|
|
1
|
-
require 'faraday_middleware'
|
2
|
-
require 'faraday/raise_paychex_http_exception'
|
3
|
-
|
4
|
-
module Paychex
|
5
|
-
module Connection
|
6
|
-
private
|
7
|
-
|
8
|
-
def connection
|
9
|
-
options = {
|
10
|
-
headers: {
|
11
|
-
'Accept' => "application/#{format}",
|
12
|
-
'User-Agent' => user_agent
|
13
|
-
},
|
14
|
-
proxy: proxy,
|
15
|
-
url: endpoint
|
16
|
-
}.merge(connection_options)
|
17
|
-
|
18
|
-
Faraday::Connection.new(options) do |conn|
|
19
|
-
conn.authorization :Bearer, access_token unless access_token.nil?
|
20
|
-
# https://github.com/lostisland/faraday/issues/417#issuecomment-223413386
|
21
|
-
conn.options[:timeout] = timeout
|
22
|
-
conn.options[:open_timeout] = open_timeout
|
23
|
-
conn.request :json
|
24
|
-
conn.request :instrumentation, name: 'request.paychex'
|
25
|
-
|
26
|
-
conn.use ::PaychexFaradayMiddleWare::RaisePaychexHttpException
|
27
|
-
conn.response :json, content_type: /\bjson$/
|
28
|
-
conn.adapter Faraday.default_adapter
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
1
|
+
require 'faraday_middleware'
|
2
|
+
require 'faraday/raise_paychex_http_exception'
|
3
|
+
|
4
|
+
module Paychex
|
5
|
+
module Connection
|
6
|
+
private
|
7
|
+
|
8
|
+
def connection
|
9
|
+
options = {
|
10
|
+
headers: {
|
11
|
+
'Accept' => "application/#{format}",
|
12
|
+
'User-Agent' => user_agent
|
13
|
+
},
|
14
|
+
proxy: proxy,
|
15
|
+
url: endpoint
|
16
|
+
}.merge(connection_options)
|
17
|
+
|
18
|
+
Faraday::Connection.new(options) do |conn|
|
19
|
+
conn.authorization :Bearer, access_token unless access_token.nil?
|
20
|
+
# https://github.com/lostisland/faraday/issues/417#issuecomment-223413386
|
21
|
+
conn.options[:timeout] = timeout
|
22
|
+
conn.options[:open_timeout] = open_timeout
|
23
|
+
conn.request :json
|
24
|
+
conn.request :instrumentation, name: 'request.paychex'
|
25
|
+
|
26
|
+
conn.use ::PaychexFaradayMiddleWare::RaisePaychexHttpException
|
27
|
+
conn.response :json, content_type: /\bjson$/
|
28
|
+
conn.adapter Faraday.default_adapter
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/paychex/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paychex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mayank Dedhia
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -199,7 +199,7 @@ metadata:
|
|
199
199
|
homepage_uri: https://github.com/helloworld1812/paychex-ruby-gem
|
200
200
|
source_code_uri: https://github.com/helloworld1812/paychex-ruby-gem
|
201
201
|
changelog_uri: https://github.com/helloworld1812/paychex-ruby-gem/CHANGELOG.md
|
202
|
-
post_install_message:
|
202
|
+
post_install_message:
|
203
203
|
rdoc_options: []
|
204
204
|
require_paths:
|
205
205
|
- lib
|
@@ -215,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
215
|
version: '0'
|
216
216
|
requirements: []
|
217
217
|
rubygems_version: 3.0.3.1
|
218
|
-
signing_key:
|
218
|
+
signing_key:
|
219
219
|
specification_version: 4
|
220
220
|
summary: Ruby wrapper for paychex.com APIs.
|
221
221
|
test_files: []
|