paychex_api 0.0.21 → 0.0.26

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
- SHA1:
3
- metadata.gz: 4dc81e7f106b07b5d468ebd0d5ff210c164b939d
4
- data.tar.gz: 69cbfce0edcf806087660873ff22ec6fd0da5728
2
+ SHA256:
3
+ metadata.gz: 2f72a02ebb9077fda3a04a01702c7cc0cb6b2f935922a96f792285456f0c2309
4
+ data.tar.gz: 6332d3d87f09fd1e0eaf556ac5571cbbcffa32a8cea53cc1d48ebfd967f95a0a
5
5
  SHA512:
6
- metadata.gz: 84d2c7a6a9039d6e7fc8f911b79930dd0ac54fbbfa219810a5102720e856f7670f717ff42766f9ee088a64723b92728f0bf8c0df35788c43309914ab184f47ce
7
- data.tar.gz: 35b44abfcf14b428279f9413f500d3029eb4cbd229a4cf60872071dbe2ea002cfab372406b43405904ba2b01676336b218c97d8acf9454cf4af75de786a8ff85
6
+ metadata.gz: cf887d44b56107c7d554322c9d0c6f5333dbc0b56414f237fb051a5d3fd198320d08f656ebe6b45c9b5e5143d3d6a83515ab3c4ea51fb8c5a0608df0ff2d96e1
7
+ data.tar.gz: 898d26059ce7b3068d330b51ef822865c390e52ffbd95bbefee8e95603d17bf399f03c3e332bb52cf57e76c9f495de2b1805ab6b952aefad1c844aa6c272f502
@@ -0,0 +1,34 @@
1
+ # Virtual environments with possible versions infos: https://github.com/actions/virtual-environments
2
+
3
+ name: CI
4
+ on: [push]
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2 # Step 1: github action that clones the repository
10
+ - name: Setup Ruby # Step 2 (we gave the name 'Setup Ruby' to this step)
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 2.5.0
14
+ - name: Install bundle and gems # Step 4
15
+ run: |
16
+ gem install bundler
17
+ bundle install --jobs 4 --retry 3
18
+ - if: ${{ failure() }}
19
+ run: echo "Something went wrong on the previous steps"
20
+ - if: ${{ success() }}
21
+ name: Run Rubocop # Step 7
22
+ run: bundle exec rubocop
23
+ brakeman:
24
+ name: runner / brakeman # Step 8
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - name: Check out code
28
+ uses: actions/checkout@v1
29
+ - name: brakeman
30
+ uses: reviewdog/action-brakeman@v1
31
+ with:
32
+ brakeman_version: 4.8.2
33
+ github_token: ${{ secrets.github_token }}
34
+ reporter: github-pr-review # Default is github-pr-check
data/.gitignore CHANGED
@@ -6,3 +6,4 @@ bridge_api.iml
6
6
  .byebug_history
7
7
  *.gem
8
8
  coverage
9
+ .history
@@ -1,64 +1,71 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paychex_api (0.0.19)
5
- faraday (~> 0.9.2)
6
- faraday_middleware (~> 0.9.2)
4
+ paychex_api (0.0.26)
5
+ faraday (~> 0.9.0)
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.0)
12
+ activesupport (6.1.1)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
- i18n (>= 0.7, < 2)
15
- minitest (~> 5.1)
16
- tzinfo (~> 1.1)
17
- addressable (2.5.2)
18
- public_suffix (>= 2.0.2, < 4.0)
19
- ast (2.4.0)
20
- byebug (8.2.5)
21
- coderay (1.1.2)
22
- concurrent-ruby (1.0.5)
14
+ i18n (>= 1.6, < 2)
15
+ minitest (>= 5.1)
16
+ tzinfo (~> 2.0)
17
+ zeitwerk (~> 2.3)
18
+ addressable (2.7.0)
19
+ public_suffix (>= 2.0.2, < 5.0)
20
+ ast (2.4.1)
21
+ byebug (11.1.3)
22
+ coderay (1.1.3)
23
+ concurrent-ruby (1.1.7)
23
24
  crack (0.4.3)
24
25
  safe_yaml (~> 1.0.0)
25
- diff-lcs (1.3)
26
- docile (1.3.0)
26
+ diff-lcs (1.4.4)
27
+ docile (1.3.2)
27
28
  faraday (0.9.2)
28
29
  multipart-post (>= 1.2, < 3)
29
- faraday_middleware (0.9.2)
30
- faraday (>= 0.7.4, < 0.10)
30
+ faraday_middleware (0.14.0)
31
+ faraday (>= 0.7.4, < 1.0)
31
32
  footrest (0.5.3)
32
33
  activesupport (>= 3.0.0)
33
34
  faraday (>= 0.9.0, < 1)
34
35
  link_header (>= 0.0.7)
35
- gergich (0.2.2)
36
- httparty (~> 0.6)
37
- sqlite3 (~> 1.3)
38
- hashdiff (0.3.7)
39
- httparty (0.16.2)
36
+ gergich (1.2.0)
37
+ httparty (~> 0.17)
38
+ sqlite3 (~> 1.4)
39
+ hashdiff (1.0.1)
40
+ httparty (0.18.1)
41
+ mime-types (~> 3.0)
40
42
  multi_xml (>= 0.5.2)
41
- i18n (1.0.1)
43
+ i18n (1.8.7)
42
44
  concurrent-ruby (~> 1.0)
43
- json (2.1.0)
44
45
  link_header (0.0.8)
45
- method_source (0.9.0)
46
- minitest (5.11.3)
46
+ method_source (1.0.0)
47
+ mime-types (3.3.1)
48
+ mime-types-data (~> 3.2015)
49
+ mime-types-data (3.2020.0512)
50
+ minitest (5.14.3)
47
51
  multi_xml (0.6.0)
48
- multipart-post (2.0.0)
49
- parallel (1.12.1)
50
- parser (2.5.1.0)
51
- ast (~> 2.4.0)
52
- powerpack (0.1.1)
53
- pry (0.11.3)
54
- coderay (~> 1.1.0)
55
- method_source (~> 0.9.0)
56
- public_suffix (3.0.1)
57
- rack (1.6.8)
58
- rack-protection (1.5.3)
52
+ multipart-post (2.1.1)
53
+ mustermann (1.1.1)
54
+ ruby2_keywords (~> 0.0.1)
55
+ parallel (1.19.2)
56
+ parser (2.7.1.4)
57
+ ast (~> 2.4.1)
58
+ pry (0.13.1)
59
+ coderay (~> 1.1)
60
+ method_source (~> 1.0)
61
+ public_suffix (4.0.5)
62
+ rack (2.2.3)
63
+ rack-protection (2.0.8.1)
59
64
  rack
60
65
  rainbow (3.0.0)
61
- rake (0.9.6)
66
+ rake (13.0.1)
67
+ regexp_parser (1.7.1)
68
+ rexml (3.2.4)
62
69
  rspec (2.99.0)
63
70
  rspec-core (~> 2.99.0)
64
71
  rspec-expectations (~> 2.99.0)
@@ -67,51 +74,55 @@ GEM
67
74
  rspec-expectations (2.99.2)
68
75
  diff-lcs (>= 1.1.3, < 2.0)
69
76
  rspec-mocks (2.99.4)
70
- rubocop (0.54.0)
77
+ rubocop (0.88.0)
71
78
  parallel (~> 1.10)
72
- parser (>= 2.5)
73
- powerpack (~> 0.1)
79
+ parser (>= 2.7.1.1)
74
80
  rainbow (>= 2.2.2, < 4.0)
81
+ regexp_parser (>= 1.7)
82
+ rexml
83
+ rubocop-ast (>= 0.1.0, < 1.0)
75
84
  ruby-progressbar (~> 1.7)
76
- unicode-display_width (~> 1.0, >= 1.0.1)
77
- ruby-progressbar (1.9.0)
78
- safe_yaml (1.0.4)
79
- simplecov (0.16.1)
85
+ unicode-display_width (>= 1.4.0, < 2.0)
86
+ rubocop-ast (0.2.0)
87
+ parser (>= 2.7.0.1)
88
+ ruby-progressbar (1.10.1)
89
+ ruby2_keywords (0.0.2)
90
+ safe_yaml (1.0.5)
91
+ simplecov (0.18.5)
80
92
  docile (~> 1.1)
81
- json (>= 1.8, < 3)
82
- simplecov-html (~> 0.10.0)
83
- simplecov-html (0.10.2)
84
- sinatra (1.4.8)
85
- rack (~> 1.5)
86
- rack-protection (~> 1.4)
87
- tilt (>= 1.3, < 3)
88
- sqlite3 (1.3.13)
89
- thread_safe (0.3.6)
90
- tilt (1.4.1)
91
- tzinfo (1.2.5)
92
- thread_safe (~> 0.1)
93
- unicode-display_width (1.3.2)
94
- webmock (1.22.6)
93
+ simplecov-html (~> 0.11)
94
+ simplecov-html (0.12.2)
95
+ sinatra (2.0.8.1)
96
+ mustermann (~> 1.0)
97
+ rack (~> 2.0)
98
+ rack-protection (= 2.0.8.1)
99
+ tilt (~> 2.0)
100
+ sqlite3 (1.4.2)
101
+ tilt (2.0.10)
102
+ tzinfo (2.0.4)
103
+ concurrent-ruby (~> 1.0)
104
+ unicode-display_width (1.7.0)
105
+ webmock (3.8.3)
95
106
  addressable (>= 2.3.6)
96
107
  crack (>= 0.3.2)
97
- hashdiff
108
+ hashdiff (>= 0.4.0, < 2.0.0)
109
+ zeitwerk (2.4.2)
98
110
 
99
111
  PLATFORMS
100
112
  ruby
101
113
 
102
114
  DEPENDENCIES
103
- bundler (~> 1.0, >= 1.0.0)
104
- byebug (~> 8.2.2)
105
- gergich (~> 0.2.2)
115
+ bundler (>= 1.0)
116
+ byebug (>= 8.2)
117
+ gergich (~> 1.0)
106
118
  paychex_api!
107
- pry (~> 0)
108
- rake (~> 0)
119
+ pry (>= 0.12)
120
+ rake (>= 1.0)
109
121
  rspec (~> 2.6)
110
- rubocop (~> 0.54.0)
111
- simplecov (~> 0.16.1)
112
- sinatra (~> 1.0)
113
- tilt (~> 1.3, >= 1.3.4)
114
- webmock (~> 1.22.6)
122
+ rubocop (~> 0.54)
123
+ simplecov (~> 0.16)
124
+ sinatra (>= 1.0, < 3)
125
+ webmock (>= 1.22)
115
126
 
116
127
  BUNDLED WITH
117
- 1.16.1
128
+ 1.17.3
@@ -0,0 +1 @@
1
+ # paychex-api [![Build Status](https://semaphoreci.com/api/v1/projects/4e099653-8dee-49ac-9842-99cc0d62d29c/3343193/badge.svg)](https://semaphoreci.com/neomind/paychex-api)
@@ -1,4 +1,4 @@
1
-
1
+ # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
2
2
  module PaychexAPI
3
3
  class ApiArray
4
4
  include Enumerable
@@ -63,7 +63,7 @@ module PaychexAPI
63
63
  def each_page
64
64
  yield(members, @linked, @meta)
65
65
  while @next_page
66
- response = get_page(@next_page)
66
+ response = page(@next_page)
67
67
  apply_response_metadata(response, false)
68
68
  @members = get_response_content(response)
69
69
  yield(members, @linked, @meta)
@@ -73,6 +73,7 @@ module PaychexAPI
73
73
 
74
74
  def all_pages!
75
75
  return self unless pages?
76
+
76
77
  combine_page
77
78
  combine_pages
78
79
  self
@@ -89,29 +90,42 @@ module PaychexAPI
89
90
  end
90
91
 
91
92
  def combine_page
92
- response = get_page(@next_page)
93
+ response = page(@next_page)
93
94
  apply_response_metadata(response)
94
95
  @members.concat(get_response_content(response))
95
96
  end
96
97
 
97
- def get_page(url, params = {})
98
+ def page(url, params = {}, tries = 0)
98
99
  query = URI.parse(url).query
99
100
  p = CGI.parse(query).merge(params)
100
101
  u = url.gsub("?#{query}", '')
102
+
101
103
  p.each { |k, v| p[k] = v.first if v.is_a?(Array) }
102
- @api_client.connection.send(:get) do |r|
104
+
105
+ resp = @api_client.connection.send(:get) do |r|
103
106
  r.url(u, p)
104
107
  end
108
+
109
+ tries = 0 if status == 200
110
+ resp
111
+ rescue Footrest::HttpError::Unauthorized => e
112
+ raise e unless tries.zero?
113
+
114
+ # token may have expired for long running pagination requests, refresh and try again
115
+ @api_client.refresh_token!
116
+ page(url, params, (tries + 1))
105
117
  end
106
118
 
107
119
  def load_page(url)
108
- response = get_page(url)
120
+ response = page(url)
109
121
  ApiArray.process_response(response, @api_client)
110
122
  end
111
123
 
112
124
  def get_response_content(response)
113
125
  body = response.body
126
+
114
127
  return [] unless body.is_a?(Hash)
128
+
115
129
  if body.key?('content')
116
130
  body['content'] || []
117
131
  else
@@ -124,9 +138,11 @@ module PaychexAPI
124
138
  @links = []
125
139
  @metadata = {}
126
140
  end
141
+
127
142
  @status = response.status
128
143
  @headers = response.headers
129
144
  @method = response.env[:method]
145
+
130
146
  init_pages(response)
131
147
  init_linked(response)
132
148
  init_meta(response)
@@ -134,16 +150,19 @@ module PaychexAPI
134
150
 
135
151
  def init_linked(response)
136
152
  return nil unless response.body.is_a?(Hash) && response.body.key?('links')
153
+
137
154
  @links = @links.concat(response.body['links'])
138
155
  end
139
156
 
140
157
  def init_meta(response)
141
158
  return nil unless response.body.is_a?(Hash) && response.body.key?('metadata')
159
+
142
160
  @metadata = response.body['metadata']
143
161
  end
144
162
 
145
163
  def init_pages(response)
146
164
  return nil unless response.body.is_a?(Hash) && response.body.key?('links')
165
+
147
166
  @next_page, @prev_page = nil
148
167
  response.body['links'].each do |link|
149
168
  case link['rel']
@@ -156,3 +175,4 @@ module PaychexAPI
156
175
  end
157
176
  end
158
177
  end
178
+ # rubocop:enable Metrics/AbcSize,Metrics/MethodLength
@@ -10,9 +10,11 @@ require 'base64'
10
10
  require 'active_support/time'
11
11
  require 'paychex_api/api_array'
12
12
 
13
+ # rubocop:disable Lint/NonDeterministicRequireOrder
13
14
  module PaychexAPI
14
15
  class Client < Footrest::Client
15
16
  API_PATH = ''.freeze
17
+ STATUS_PATH = '/status'.freeze
16
18
  COMPANIES_PATH = '/companies'.freeze
17
19
  ASSOCIATIONS_PATH = '/'.freeze
18
20
  ORGANIZATIONS_PATH = '/organizations'.freeze
@@ -46,10 +48,17 @@ module PaychexAPI
46
48
 
47
49
  def token
48
50
  return config[:token] if config[:token].present?
51
+
49
52
  authorize if @authorization.blank? || @authorization['expiration'] <= Time.now - 30.seconds
50
53
  @authorization['access_token']
51
54
  end
52
55
 
56
+ def refresh_token!
57
+ config.delete(:token)
58
+ authorize
59
+ connection.headers[:authorization] = "Bearer #{token}"
60
+ end
61
+
53
62
  def authorize
54
63
  response = faraday_auth.post(
55
64
  OAUTH_TOKEN_PATH,
@@ -143,3 +152,4 @@ module PaychexAPI
143
152
  end
144
153
  end
145
154
  end
155
+ # rubocop:enable Lint/NonDeterministicRequireOrder
@@ -1,9 +1,11 @@
1
+ # rubocop:disable Lint/UriEscapeUnescape
1
2
  module PaychexAPI
2
3
  class Client
3
4
  module Notifications
4
5
  def send_notification(notification_id, params = {})
5
- post("#{API_PATH}#{NOTIFICATIONS_PATH}/#{notification_id}", params)
6
+ post("#{API_PATH}#{NOTIFICATIONS_PATH}/#{URI.escape(notification_id)}", params)
6
7
  end
7
8
  end
8
9
  end
9
10
  end
11
+ # rubocop:enable Lint/UriEscapeUnescape
@@ -0,0 +1,17 @@
1
+ module PaychexAPI
2
+ class Client
3
+ module Statuses
4
+ def company_status(params = {})
5
+ get("#{API_PATH}#{STATUS_PATH}/company", params)
6
+ end
7
+
8
+ def user_status(params = {})
9
+ get("#{API_PATH}#{STATUS_PATH}/user", params)
10
+ end
11
+
12
+ def worker_status(params = {})
13
+ get("#{API_PATH}#{STATUS_PATH}/worker", params)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module PaychexAPI
2
- VERSION = '0.0.21'.freeze unless defined?(PaychexAPI::VERSION)
2
+ VERSION = '0.0.26'.freeze unless defined?(PaychexAPI::VERSION)
3
3
  end
@@ -1,5 +1,5 @@
1
-
2
1
  $LOAD_PATH.push File.expand_path('lib', __dir__)
2
+
3
3
  require 'paychex_api/version'
4
4
 
5
5
  Gem::Specification.new do |gem|
@@ -18,19 +18,18 @@ Gem::Specification.new do |gem|
18
18
  gem.require_paths = ['lib']
19
19
  gem.version = PaychexAPI::VERSION
20
20
 
21
- gem.add_development_dependency 'bundler', '~> 1.0', '>= 1.0.0'
22
- gem.add_development_dependency 'byebug', '~> 8.2.2'
23
- gem.add_development_dependency 'gergich', '~> 0.2.2'
24
- gem.add_development_dependency 'pry', '~> 0'
25
- gem.add_development_dependency 'rake', '~> 0'
21
+ gem.add_development_dependency 'bundler', '>= 1.0'
22
+ gem.add_development_dependency 'byebug', '>= 8.2'
23
+ gem.add_development_dependency 'gergich', '~> 1.0'
24
+ gem.add_development_dependency 'pry', '>= 0.12'
25
+ gem.add_development_dependency 'rake', '>= 1.0'
26
26
  gem.add_development_dependency 'rspec', '~> 2.6'
27
- gem.add_development_dependency 'rubocop', '~> 0.54.0'
28
- gem.add_development_dependency 'simplecov', '~> 0.16.1'
29
- gem.add_development_dependency 'sinatra', '~> 1.0'
30
- gem.add_development_dependency 'tilt', '>= 1.3.4', '~> 1.3'
31
- gem.add_development_dependency 'webmock', '~>1.22.6'
27
+ gem.add_development_dependency 'rubocop', '~> 0.54'
28
+ gem.add_development_dependency 'simplecov', '~> 0.16'
29
+ gem.add_development_dependency 'sinatra', '>= 1.0', '< 3'
30
+ gem.add_development_dependency 'webmock', '>= 1.22'
32
31
 
33
- gem.add_dependency 'faraday', '~> 0.9.2'
32
+ gem.add_dependency 'faraday', '~> 0.9.0'
34
33
  gem.add_dependency 'faraday_middleware', '>= 0.12.2'
35
34
  gem.add_dependency 'footrest', '>= 0.5.1'
36
35
  end
@@ -0,0 +1,5 @@
1
+ {
2
+ "health": {
3
+ "status": "UP"
4
+ }
5
+ }
@@ -1,10 +1,11 @@
1
1
  require 'test_helper'
2
+
2
3
  describe PaychexAPI::Client::Notifications do
3
4
  let!(:body) do
4
5
  {
5
6
  'companyId' => '00Z5V9BTI687WL8V60GT',
6
7
  'asOfDate' => '2018-01-12T00:00:00Z',
7
- 'domains' => ['CLT_PROD'],
8
+ 'domains' => ['CLT_PROD'],
8
9
  'action' => 'ADD',
9
10
  'productCode' => 'LMS_ENH'
10
11
  }
@@ -1,4 +1,5 @@
1
1
  require 'test_helper'
2
+
2
3
  describe PaychexAPI::Client::Notifications do
3
4
  before do
4
5
  @client = PaychexAPI::Client.new(
@@ -8,6 +9,15 @@ describe PaychexAPI::Client::Notifications do
8
9
 
9
10
  it 'should send a notification' do
10
11
  response = @client.send_notification('f7f9c815-0d4c-46e5-9434-5cc19470d1ed-3520000031155394')
12
+
11
13
  expect(response.status).to(eq(200))
12
14
  end
15
+
16
+ it 'should URI escape a notification id' do
17
+ expect_any_instance_of(PaychexAPI::Client::Notifications)
18
+ .to receive(:post)
19
+ .with('/notifications/f7f9c815-0d4c-46e5-9434-5cc1%209470d1ed-3520000031155394', {})
20
+
21
+ @client.send_notification('f7f9c815-0d4c-46e5-9434-5cc1 9470d1ed-3520000031155394')
22
+ end
13
23
  end
@@ -0,0 +1,23 @@
1
+ require 'test_helper'
2
+ describe PaychexAPI::Client::Statuses do
3
+ before do
4
+ @client = PaychexAPI::Client.new(
5
+ prefix: 'http://test.paychex.com', client_id: 'client_id', client_secret: 'client_secret'
6
+ )
7
+ end
8
+
9
+ it 'should get company status' do
10
+ response = @client.company_status
11
+ expect(response['health']['status']).to(eq('UP'))
12
+ end
13
+
14
+ it 'should get user status' do
15
+ response = @client.user_status
16
+ expect(response['health']['status']).to(eq('UP'))
17
+ end
18
+
19
+ it 'should get worker status' do
20
+ response = @client.worker_status
21
+ expect(response['health']['status']).to(eq('UP'))
22
+ end
23
+ end
@@ -3,25 +3,25 @@ require 'tilt'
3
3
 
4
4
  class FakePaychex < Sinatra::Base
5
5
  # auth
6
- post %r{/auth/oauth/v2/token$} do
6
+ post %r{/auth/oauth/v2/token} do
7
7
  get_json_data 200, 'auth.json'
8
8
  end
9
9
 
10
10
  # workers
11
- get %r{/companies/.*/workers.*$} do
11
+ get %r{/companies/.*/workers.*} do
12
12
  get_json_data 200, 'workers.json'
13
13
  end
14
14
 
15
15
  # workers
16
- get %r{/companies/.*/workers/\+d+$} do
16
+ get %r{/companies/.*/workers/\+d+} do
17
17
  get_json_data 200, 'workers.json'
18
18
  end
19
19
 
20
- get %r{/workers/\d+$} do
20
+ get %r{/workers/\d+} do
21
21
  get_json_data 200, 'workers.json'
22
22
  end
23
23
 
24
- get %r{/workers/\d+/users$} do
24
+ get %r{/workers/\d+/users} do
25
25
  case request.env['HTTP_ACCEPT']
26
26
  when "application/json;profile='http://api.paychex.com/profiles/users/v1'"
27
27
  get_json_data 200, 'users.json'
@@ -30,29 +30,29 @@ class FakePaychex < Sinatra::Base
30
30
  end
31
31
  end
32
32
 
33
- get %r{/workers/\d+/communications$} do
33
+ get %r{/workers/\d+/communications} do
34
34
  get_json_data 200, 'communications.json'
35
35
  end
36
36
 
37
- get %r{/workers/\d+/communications/\d+$} do
37
+ get %r{/workers/\d+/communications/\d+} do
38
38
  get_json_data 200, 'communications.json'
39
39
  end
40
40
 
41
- post %r{/workers/\d+/communications$} do
41
+ post %r{/workers/\d+/communications} do
42
42
  get_json_data 200, 'communications.json'
43
43
  end
44
44
 
45
- put %r{/workers/\d+/communications/\d+$} do
45
+ put %r{/workers/\d+/communications/\d+} do
46
46
  get_json_data 200, 'communications.json'
47
47
  end
48
48
 
49
- delete %r{/workers/\d+/communications/\d+$} do
49
+ delete %r{/workers/\d+/communications/\d+} do
50
50
  get_json_data 200, 'communications.json'
51
51
  end
52
52
 
53
53
  # companies
54
54
 
55
- get %r{/companies/[A-Za-z0-9]+$} do
55
+ get %r{/companies/[A-Za-z0-9]+} do
56
56
  case request.env['HTTP_ACCEPT']
57
57
  when "application/json;profile='http://api.paychex.com/profiles/company_associations/v1'"
58
58
  get_json_data 200, 'companies_associations.json'
@@ -61,38 +61,43 @@ class FakePaychex < Sinatra::Base
61
61
  end
62
62
  end
63
63
 
64
- get %r{/companies$} do
64
+ get %r{/companies} do
65
65
  get_json_data 200, 'companies.json'
66
66
  end
67
67
 
68
- get %r{/companies/[A-Za-z0-9]+/organizations+$} do
68
+ get %r{/companies/[A-Za-z0-9]+/organizations+} do
69
69
  get_json_data 200, 'organizations.json'
70
70
  end
71
71
 
72
- post %r{/companies/[A-Za-z0-9]+/purchases+$} do
72
+ post %r{/companies/[A-Za-z0-9]+/purchases+} do
73
73
  get_json_data 200, 'organizations.json'
74
74
  end
75
75
 
76
76
  # Notifications
77
77
 
78
- post %r{/notifications/\S+$} do
78
+ post %r{/notifications/\S+} do
79
79
  get_json_data 200, 'communications.json'
80
80
  end
81
81
 
82
82
  # Messages
83
83
 
84
- post %r{/messages$} do
84
+ post %r{/messages} do
85
85
  get_json_data 201, 'messages.json'
86
86
  end
87
87
 
88
- get %r{/users.*$} do
88
+ get %r{/users.*} do
89
89
  get_json_data 200, 'users.json'
90
90
  end
91
91
 
92
- get %r{/users/\S/workers+$} do
92
+ get %r{/users/\S/workers+} do
93
93
  get_json_data 200, 'workers.json'
94
94
  end
95
95
 
96
+ # Statuses
97
+ get %r{/status.*} do
98
+ get_json_data 200, 'status.json'
99
+ end
100
+
96
101
  private
97
102
 
98
103
  def get_json_data(response_code, file_name)
metadata CHANGED
@@ -1,91 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paychex_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.0.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Shaffer
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-14 00:00:00.000000000 Z
11
+ date: 2021-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.0'
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
- version: 1.0.0
19
+ version: '1.0'
23
20
  type: :development
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '1.0'
30
24
  - - ">="
31
25
  - !ruby/object:Gem::Version
32
- version: 1.0.0
26
+ version: '1.0'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: byebug
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - "~>"
31
+ - - ">="
38
32
  - !ruby/object:Gem::Version
39
- version: 8.2.2
33
+ version: '8.2'
40
34
  type: :development
41
35
  prerelease: false
42
36
  version_requirements: !ruby/object:Gem::Requirement
43
37
  requirements:
44
- - - "~>"
38
+ - - ">="
45
39
  - !ruby/object:Gem::Version
46
- version: 8.2.2
40
+ version: '8.2'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: gergich
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
45
  - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: 0.2.2
47
+ version: '1.0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
51
  requirements:
58
52
  - - "~>"
59
53
  - !ruby/object:Gem::Version
60
- version: 0.2.2
54
+ version: '1.0'
61
55
  - !ruby/object:Gem::Dependency
62
56
  name: pry
63
57
  requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
- - - "~>"
59
+ - - ">="
66
60
  - !ruby/object:Gem::Version
67
- version: '0'
61
+ version: '0.12'
68
62
  type: :development
69
63
  prerelease: false
70
64
  version_requirements: !ruby/object:Gem::Requirement
71
65
  requirements:
72
- - - "~>"
66
+ - - ">="
73
67
  - !ruby/object:Gem::Version
74
- version: '0'
68
+ version: '0.12'
75
69
  - !ruby/object:Gem::Dependency
76
70
  name: rake
77
71
  requirement: !ruby/object:Gem::Requirement
78
72
  requirements:
79
- - - "~>"
73
+ - - ">="
80
74
  - !ruby/object:Gem::Version
81
- version: '0'
75
+ version: '1.0'
82
76
  type: :development
83
77
  prerelease: false
84
78
  version_requirements: !ruby/object:Gem::Requirement
85
79
  requirements:
86
- - - "~>"
80
+ - - ">="
87
81
  - !ruby/object:Gem::Version
88
- version: '0'
82
+ version: '1.0'
89
83
  - !ruby/object:Gem::Dependency
90
84
  name: rspec
91
85
  requirement: !ruby/object:Gem::Requirement
@@ -106,90 +100,76 @@ dependencies:
106
100
  requirements:
107
101
  - - "~>"
108
102
  - !ruby/object:Gem::Version
109
- version: 0.54.0
103
+ version: '0.54'
110
104
  type: :development
111
105
  prerelease: false
112
106
  version_requirements: !ruby/object:Gem::Requirement
113
107
  requirements:
114
108
  - - "~>"
115
109
  - !ruby/object:Gem::Version
116
- version: 0.54.0
110
+ version: '0.54'
117
111
  - !ruby/object:Gem::Dependency
118
112
  name: simplecov
119
113
  requirement: !ruby/object:Gem::Requirement
120
114
  requirements:
121
115
  - - "~>"
122
116
  - !ruby/object:Gem::Version
123
- version: 0.16.1
117
+ version: '0.16'
124
118
  type: :development
125
119
  prerelease: false
126
120
  version_requirements: !ruby/object:Gem::Requirement
127
121
  requirements:
128
122
  - - "~>"
129
123
  - !ruby/object:Gem::Version
130
- version: 0.16.1
124
+ version: '0.16'
131
125
  - !ruby/object:Gem::Dependency
132
126
  name: sinatra
133
- requirement: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - "~>"
136
- - !ruby/object:Gem::Version
137
- version: '1.0'
138
- type: :development
139
- prerelease: false
140
- version_requirements: !ruby/object:Gem::Requirement
141
- requirements:
142
- - - "~>"
143
- - !ruby/object:Gem::Version
144
- version: '1.0'
145
- - !ruby/object:Gem::Dependency
146
- name: tilt
147
127
  requirement: !ruby/object:Gem::Requirement
148
128
  requirements:
149
129
  - - ">="
150
130
  - !ruby/object:Gem::Version
151
- version: 1.3.4
152
- - - "~>"
131
+ version: '1.0'
132
+ - - "<"
153
133
  - !ruby/object:Gem::Version
154
- version: '1.3'
134
+ version: '3'
155
135
  type: :development
156
136
  prerelease: false
157
137
  version_requirements: !ruby/object:Gem::Requirement
158
138
  requirements:
159
139
  - - ">="
160
140
  - !ruby/object:Gem::Version
161
- version: 1.3.4
162
- - - "~>"
141
+ version: '1.0'
142
+ - - "<"
163
143
  - !ruby/object:Gem::Version
164
- version: '1.3'
144
+ version: '3'
165
145
  - !ruby/object:Gem::Dependency
166
146
  name: webmock
167
147
  requirement: !ruby/object:Gem::Requirement
168
148
  requirements:
169
- - - "~>"
149
+ - - ">="
170
150
  - !ruby/object:Gem::Version
171
- version: 1.22.6
151
+ version: '1.22'
172
152
  type: :development
173
153
  prerelease: false
174
154
  version_requirements: !ruby/object:Gem::Requirement
175
155
  requirements:
176
- - - "~>"
156
+ - - ">="
177
157
  - !ruby/object:Gem::Version
178
- version: 1.22.6
158
+ version: '1.22'
179
159
  - !ruby/object:Gem::Dependency
180
160
  name: faraday
181
161
  requirement: !ruby/object:Gem::Requirement
182
162
  requirements:
183
163
  - - "~>"
184
164
  - !ruby/object:Gem::Version
185
- version: 0.9.2
165
+ version: 0.9.0
186
166
  type: :runtime
187
167
  prerelease: false
188
168
  version_requirements: !ruby/object:Gem::Requirement
189
169
  requirements:
190
170
  - - "~>"
191
171
  - !ruby/object:Gem::Version
192
- version: 0.9.2
172
+ version: 0.9.0
193
173
  - !ruby/object:Gem::Dependency
194
174
  name: faraday_middleware
195
175
  requirement: !ruby/object:Gem::Requirement
@@ -225,12 +205,14 @@ executables: []
225
205
  extensions: []
226
206
  extra_rdoc_files: []
227
207
  files:
208
+ - ".github/workflows/ci.yml"
228
209
  - ".gitignore"
229
210
  - ".rubocop.yml"
230
211
  - ".simplecov"
231
212
  - Dockerfile
232
213
  - Gemfile
233
214
  - Gemfile.lock
215
+ - README.md
234
216
  - bin/jenkins
235
217
  - build.sh
236
218
  - docker-compose.yml
@@ -242,6 +224,7 @@ files:
242
224
  - lib/paychex_api/client/messages.rb
243
225
  - lib/paychex_api/client/notifications.rb
244
226
  - lib/paychex_api/client/purchases.rb
227
+ - lib/paychex_api/client/statuses.rb
245
228
  - lib/paychex_api/client/users.rb
246
229
  - lib/paychex_api/client/workers.rb
247
230
  - lib/paychex_api/version.rb
@@ -253,6 +236,7 @@ files:
253
236
  - spec/fixtures/companies_associations.json
254
237
  - spec/fixtures/messages.json
255
238
  - spec/fixtures/organizations.json
239
+ - spec/fixtures/status.json
256
240
  - spec/fixtures/users.json
257
241
  - spec/fixtures/workers.json
258
242
  - spec/paychex_api/api_array_spec.rb
@@ -261,6 +245,7 @@ files:
261
245
  - spec/paychex_api/client/messages_spec.rb
262
246
  - spec/paychex_api/client/notifications_spec.rb
263
247
  - spec/paychex_api/client/purchases_spec.rb
248
+ - spec/paychex_api/client/statuses_spec.rb
264
249
  - spec/paychex_api/client/users_spec.rb
265
250
  - spec/paychex_api/client/workers_spec.rb
266
251
  - spec/paychex_api/client_spec.rb
@@ -271,7 +256,7 @@ homepage: ''
271
256
  licenses:
272
257
  - MIT
273
258
  metadata: {}
274
- post_install_message:
259
+ post_install_message:
275
260
  rdoc_options: []
276
261
  require_paths:
277
262
  - lib
@@ -286,9 +271,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
286
271
  - !ruby/object:Gem::Version
287
272
  version: '0'
288
273
  requirements: []
289
- rubyforge_project:
290
- rubygems_version: 2.5.2.1
291
- signing_key:
274
+ rubygems_version: 3.0.3
275
+ signing_key:
292
276
  specification_version: 4
293
277
  summary: Paychex API
294
278
  test_files:
@@ -298,6 +282,7 @@ test_files:
298
282
  - spec/paychex_api/client/companies_spec.rb
299
283
  - spec/paychex_api/client/associations_spec.rb
300
284
  - spec/paychex_api/client/purchases_spec.rb
285
+ - spec/paychex_api/client/statuses_spec.rb
301
286
  - spec/paychex_api/client/users_spec.rb
302
287
  - spec/paychex_api/client/messages_spec.rb
303
288
  - spec/paychex_api/client/workers_spec.rb
@@ -311,5 +296,6 @@ test_files:
311
296
  - spec/fixtures/auth.json
312
297
  - spec/fixtures/communications.json
313
298
  - spec/fixtures/association_companies.json
299
+ - spec/fixtures/status.json
314
300
  - spec/fixtures/companies_associations.json
315
301
  - spec/test_helper.rb