paychex_api 0.0.7 → 0.0.8

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
- SHA256:
3
- metadata.gz: '09da23ef04fa2ed51fcbacbeeb403ee7b1ebd80d34315f7250ef0df4466396a4'
4
- data.tar.gz: 867ef32e611a72e51927b735127e22e2e92b04d8155d95c7d293e503254945fa
2
+ SHA1:
3
+ metadata.gz: 96f5cfbc4cbd344742719fc72f7dcdc618153cf1
4
+ data.tar.gz: e0615213b5cc001ba6ff7d419f3467230f23ebd3
5
5
  SHA512:
6
- metadata.gz: dc317ce455b82ec78c5149af7add45e2b1c49279e19d1732cfca6e87f72437f24727ab8784d08248f19ea361058432e4ecee61a86ff35a29db1c3d1f478d6afd
7
- data.tar.gz: 5b7e5225ce91f61400188f6d6f04d843ae85e8e2f3821d72f13b20de2b841fd301c9c5b34b577b879f693fbfbd3c430e4d142686c5b5f143aa8d05d454369e9e
6
+ metadata.gz: 190ad40957f89ac54e989feddac662a363e5107c9372e181aca1e00e184dfd07372ed0630eecd1f8b62ca71d039f700cb6333ad1c74a607aaa5034ab0af52148
7
+ data.tar.gz: c5a248b8153a95d3ea8e32e50c3b4edf733b429633672f9fec20ec1715b1ad5ff3c70a1a34563da92423ff8b3e993339eded9d8a074a18adc66ab78d3681a11a
@@ -32,6 +32,10 @@ module PaychexAPI
32
32
  @members || []
33
33
  end
34
34
 
35
+ def size
36
+ length
37
+ end
38
+
35
39
  def length
36
40
  members.length
37
41
  end
@@ -28,6 +28,7 @@ module PaychexAPI
28
28
  PAY_COMPONENTS_PATH = '/paycomponents'.freeze
29
29
  CHECKS_PATH = '/checks'.freeze
30
30
  OAUTH_TOKEN_PATH = '/auth/oauth/v2/token'.freeze
31
+ USERS_PATH = '/users'.freeze
31
32
 
32
33
  attr_reader :authorization
33
34
 
@@ -6,10 +6,15 @@ module PaychexAPI
6
6
  end
7
7
 
8
8
  def get_company_associations(company_id, params = {})
9
- connection.headers[:accept] = "application/json;profile='https://api.paychex.com/profiles/company_associations/v1"
9
+ connection.headers[:accept] = "application/json;profile='https://api.paychex.com/profiles/company_associations/v1'"
10
10
  get("#{API_PATH}#{COMPANIES_PATH}/#{company_id}", params)
11
11
  end
12
12
 
13
+ def get_company_workers(company_id, params = {})
14
+ connection.headers[:accept] = "application/json;profile='http://api.paychex.com/profiles/workers/nonpii/v1'"
15
+ get("#{API_PATH}#{COMPANIES_PATH}/#{company_id}/#{WORKERS_PATH}", params)
16
+ end
17
+
13
18
  def get_company_by_display_id(display_id, params = {})
14
19
  params = params.merge(displayid: display_id)
15
20
  get("#{API_PATH}#{COMPANIES_PATH}", params)
@@ -0,0 +1,14 @@
1
+ module PaychexAPI
2
+ class Client
3
+ module Users
4
+ def get_user_access(user_id, params = {})
5
+ connection.headers[:accept] = "application/json;profile='http://api.paychex.com/profiles/user_access/v1'"
6
+ get("#{API_PATH}#{USERS_PATH}/#{user_id}", params)
7
+ end
8
+
9
+ def get_user(user_id, params = {})
10
+ get("#{API_PATH}#{USERS_PATH}/#{user_id}", params)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -28,6 +28,11 @@ module PaychexAPI
28
28
  def delete_communication(worker_id, communication_id, params = {})
29
29
  delete("#{API_PATH}#{WORKERS_PATH}/#{worker_id}#{COMMUNICATIONS_PATH}/#{communication_id}", params)
30
30
  end
31
+
32
+ def get_worker_user(worker_id, params = {})
33
+ connection.headers[:accept] = "application/json;profile='http://api.paychex.com/profiles/worker_users/v1'"
34
+ get("#{API_PATH}#{WORKERS_PATH}/#{worker_id}", params)
35
+ end
31
36
  end
32
37
  end
33
38
  end
@@ -1,3 +1,3 @@
1
1
  module PaychexAPI
2
- VERSION = '0.0.7'.freeze unless defined?(PaychexAPI::VERSION)
2
+ VERSION = '0.0.8'.freeze unless defined?(PaychexAPI::VERSION)
3
3
  end
@@ -0,0 +1,66 @@
1
+ {
2
+ "content": [
3
+ {
4
+ "userId": "00H2A1IUJ0B589F001CW",
5
+ "access": [
6
+ {
7
+ "companyId": "00H2A1IUJE76HYVBPNNS",
8
+ "platform": "LMS",
9
+ "application": "LMSEMPR",
10
+ "roles": [
11
+ {
12
+ "roleId": "00DCE1NVJHCACLUF0S87",
13
+ "roleName": "Manager "
14
+ },
15
+ {
16
+ "roleId": "00DCE1NVJHCACLUF0S87",
17
+ "roleName": "Manager "
18
+ }
19
+ ]
20
+ },
21
+ {
22
+ "companyId": "00H2A1IUJHGE2SOR3UT4",
23
+ "platform": "LMS",
24
+ "application": "LMSEMPR",
25
+ "roles": [
26
+ {
27
+ "roleId": "00DCE1NVJHCACLUF0S87",
28
+ "roleName": "Manager "
29
+ },
30
+ {
31
+ "roleId": "00DCE1NVJHCACLUF0S87",
32
+ "roleName": "Manager "
33
+ }
34
+ ]
35
+ }
36
+ ],
37
+ "name": {
38
+ "givenName": "Cliff",
39
+ "middleName": "Z",
40
+ "familyName": "Snow"
41
+ },
42
+ "communications": [
43
+ {
44
+ "communicationId": "00OJBKYHJ83TGXE1GXKD",
45
+ "type": "EMAIL",
46
+ "uri": "payxpink+cliff.n2a@gmail.com"
47
+ },
48
+ {
49
+ "communicationId": "00OJBKYHJ83TGXE1GXKF",
50
+ "type": "PHONE",
51
+ "dialArea": "585",
52
+ "dialNumber": "2162625"
53
+ },
54
+ {
55
+ "communicationId": "00OJBKYHJ83TGXE1GXKB",
56
+ "type": "STREET_ADDRESS",
57
+ "streetLineOne": "Address 6666",
58
+ "city": "Webster",
59
+ "postalCode": "14580",
60
+ "countrySubdivisionCode": "NY",
61
+ "countryCode": "US"
62
+ }
63
+ ]
64
+ }
65
+ ]
66
+ }
@@ -25,4 +25,9 @@ describe PaychexAPI::Client::Companies do
25
25
  response = @client.get_organizations(1, 2)
26
26
  expect(response.first['organizationId']).to(eq('970000055981384'))
27
27
  end
28
+
29
+ it 'should get company workers' do
30
+ response = @client.get_company_workers(1)
31
+ expect(response.first['workerId']).to(eq('00Z5V9BTIHRQF2CF7BTH'))
32
+ end
28
33
  end
@@ -0,0 +1,20 @@
1
+ require 'test_helper'
2
+ describe PaychexAPI::Client::Users 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 users with access' do
10
+ response = @client.get_user_access(1)
11
+ expect(response.size).to eq(1)
12
+ expect(response.first.key?('access')).to eq(true)
13
+ end
14
+
15
+ it 'should get users' do
16
+ response = @client.get_user_access(1)
17
+ expect(response.size).to eq(1)
18
+ expect(response.first.key?('access')).to eq(true)
19
+ end
20
+ end
@@ -35,4 +35,9 @@ describe PaychexAPI::Client::Workers do
35
35
  response = @client.update_communication(1, 1, something: 'something')
36
36
  expect(response.first['communicationId']).to(eq('00Z5V9BTINBT97UMERCA'))
37
37
  end
38
+
39
+ it 'should get a workers user' do
40
+ response = @client.get_worker_user(1, something: 'something')
41
+ expect(response.first['workerId']).to(eq('00Z5V9BTIHRQF2CF7BTH'))
42
+ end
38
43
  end
@@ -66,6 +66,10 @@ class FakePaychex < Sinatra::Base
66
66
  get_json_data 201, 'messages.json'
67
67
  end
68
68
 
69
+ get %r{/users.*$} do
70
+ get_json_data 200, 'users.json'
71
+ end
72
+
69
73
  private
70
74
 
71
75
  def get_json_data(response_code, file_name)
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.7
4
+ version: 0.0.8
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-06-20 00:00:00.000000000 Z
11
+ date: 2018-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -241,6 +241,7 @@ files:
241
241
  - lib/paychex_api/client/companies.rb
242
242
  - lib/paychex_api/client/messages.rb
243
243
  - lib/paychex_api/client/notifications.rb
244
+ - lib/paychex_api/client/users.rb
244
245
  - lib/paychex_api/client/workers.rb
245
246
  - lib/paychex_api/version.rb
246
247
  - paychex_api.gemspec
@@ -249,12 +250,14 @@ files:
249
250
  - spec/fixtures/companies.json
250
251
  - spec/fixtures/messages.json
251
252
  - spec/fixtures/organizations.json
253
+ - spec/fixtures/users.json
252
254
  - spec/fixtures/workers.json
253
255
  - spec/paychex_api/api_array_spec.rb
254
256
  - spec/paychex_api/client/associations_spec.rb
255
257
  - spec/paychex_api/client/companies_spec.rb
256
258
  - spec/paychex_api/client/messages_spec.rb
257
259
  - spec/paychex_api/client/notifications_spec.rb
260
+ - spec/paychex_api/client/users_spec.rb
258
261
  - spec/paychex_api/client/workers_spec.rb
259
262
  - spec/paychex_api/client_spec.rb
260
263
  - spec/paychex_api/paychex_api_spec.rb
@@ -280,7 +283,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
280
283
  version: '0'
281
284
  requirements: []
282
285
  rubyforge_project:
283
- rubygems_version: 2.7.3
286
+ rubygems_version: 2.6.14
284
287
  signing_key:
285
288
  specification_version: 4
286
289
  summary: Paychex API
@@ -290,14 +293,17 @@ test_files:
290
293
  - spec/fixtures/companies.json
291
294
  - spec/fixtures/messages.json
292
295
  - spec/fixtures/organizations.json
296
+ - spec/fixtures/users.json
293
297
  - spec/fixtures/workers.json
294
298
  - spec/paychex_api/api_array_spec.rb
295
299
  - spec/paychex_api/client/associations_spec.rb
296
300
  - spec/paychex_api/client/companies_spec.rb
297
301
  - spec/paychex_api/client/messages_spec.rb
298
302
  - spec/paychex_api/client/notifications_spec.rb
303
+ - spec/paychex_api/client/users_spec.rb
299
304
  - spec/paychex_api/client/workers_spec.rb
300
305
  - spec/paychex_api/client_spec.rb
301
306
  - spec/paychex_api/paychex_api_spec.rb
302
307
  - spec/support/fake_paychex.rb
303
308
  - spec/test_helper.rb
309
+ has_rdoc: