paychex_api 0.0.9 → 0.0.10

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: 3b88547e66293dc37be1b73a4870489b96cd6237
4
- data.tar.gz: 91c6d2a108ca0f3b9c7cadc882916822f64dfca2
2
+ SHA256:
3
+ metadata.gz: 420e55a9662715817b68cb45e13eb6daa52f915653b3d47b5e38997220e227cc
4
+ data.tar.gz: 50ca1ff1e7630e04407f36207f791fea82eabf733a24f838a5a6a9277564d9e2
5
5
  SHA512:
6
- metadata.gz: d70d2f217d7db9ef7b474c0412ff1373f6381ab8973b2427c6f4596dbccd267a38826db08cb3c1899eadd0a0c8bb1cfc972a4151e011ed1910cf7653efbd9d32
7
- data.tar.gz: 30537e3fc2a61abdc721a647324f5715e55889d0927e7b799708d1c437098eb757743eb67aabfa4bb2c14f3efdabdf3e83c956ca0ca347f4b2b5fd75a991ab6d
6
+ metadata.gz: ba20485999f91b3ce4f4e7df8ce5e642ec38e584af67cd4db5a101b817fd7498b65988bbe87ec4180945bedde432019cb5e5063b09ae3074a90f11ea3dfe7c94
7
+ data.tar.gz: 583bba223519cfd5b319fc50e8ed0469a7c8ae78d9f85195b7af7f09ec8709dc45adad6b79b67c9c58900e1f8fa2d32d7c80a1620183b94517a10099bea2d7f1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paychex_api (0.0.8)
4
+ paychex_api (0.0.10)
5
5
  faraday (~> 0.9.2)
6
6
  faraday_middleware (~> 0.9.2)
7
7
  footrest (>= 0.5.1)
@@ -10,6 +10,18 @@ module PaychexAPI
10
10
  get("#{API_PATH}#{COMPANIES_PATH}/#{company_id}", params)
11
11
  end
12
12
 
13
+ def get_company_associations_by_types(company_id, types, params = {})
14
+ connection.headers[:accept] = "application/json;profile='http://api.paychex.com/profiles/company_associations/v1'"
15
+ results = get("#{API_PATH}#{COMPANIES_PATH}/#{company_id}", params)
16
+ results.members.map! do |member|
17
+ member['associations'] = member['associations'].select do |association|
18
+ types.include?(association['associationType'])
19
+ end if member['associations'].present?
20
+ member
21
+ end
22
+ results
23
+ end
24
+
13
25
  def get_company_workers(company_id, params = {})
14
26
  connection.headers[:accept] = "application/json;profile='http://api.paychex.com/profiles/workers/nonpii/v1'"
15
27
  get("#{API_PATH}#{COMPANIES_PATH}/#{company_id}/#{WORKERS_PATH}", params)
@@ -9,6 +9,11 @@ module PaychexAPI
9
9
  def get_user(user_id, params = {})
10
10
  get("#{API_PATH}#{USERS_PATH}/#{user_id}", params)
11
11
  end
12
+
13
+ def get_user_workers(user_id, params = {})
14
+ connection.headers[:accept] = "application/json;profile='http://api.paychex.com/profiles/workers/v1'"
15
+ get("#{API_PATH}#{USERS_PATH}/#{user_id}#{WORKERS_PATH}", params)
16
+ end
12
17
  end
13
18
  end
14
19
  end
@@ -6,6 +6,7 @@ module PaychexAPI
6
6
  end
7
7
 
8
8
  def get_worker(worker_id, params = {})
9
+ connection.headers[:accept] = 'http://api.paychex.com/profiles/worker/nonpii_communications/v1'
9
10
  get("#{API_PATH}#{WORKERS_PATH}/#{worker_id}", params)
10
11
  end
11
12
 
@@ -30,8 +31,8 @@ module PaychexAPI
30
31
  end
31
32
 
32
33
  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)
34
+ connection.headers[:accept] = "application/json;profile='http://api.paychex.com/profiles/users/v1'"
35
+ get("#{API_PATH}#{WORKERS_PATH}/#{worker_id}/users", params)
35
36
  end
36
37
  end
37
38
  end
@@ -1,3 +1,3 @@
1
1
  module PaychexAPI
2
- VERSION = '0.0.9'.freeze unless defined?(PaychexAPI::VERSION)
2
+ VERSION = '0.0.10'.freeze unless defined?(PaychexAPI::VERSION)
3
3
  end
@@ -0,0 +1,48 @@
1
+ {
2
+ "content": [
3
+ {
4
+ "companyId": "99Z5V9BTI8J2FCGESC05",
5
+ "displayId": "09643075",
6
+ "legalName": "API 10 CORE SMALL BHUMPHREY 05-14-2018 1878",
7
+ "legalId": {
8
+ "legalIdType": "FEIN",
9
+ "legalIdValue": "923248058"
10
+ },
11
+ "communications": [
12
+ {
13
+ "type": "STREET_ADDRESS",
14
+ "usageType": "BUSINESS",
15
+ "streetLineOne": "1232 SAFE RD",
16
+ "city": "ROCHESTER",
17
+ "postalCode": "14607",
18
+ "countrySubdivisionCode": "NY",
19
+ "countryCode": "US"
20
+ }
21
+ ],
22
+ "associations": [
23
+ {
24
+ "associationId": "00H2A1IUJHNG0KX092KF",
25
+ "associationType": "LMS_ES_BPR",
26
+ "description": "LMS Association 1",
27
+ "siteId": "00H2A1IUJHNG0KX092KD",
28
+ "links": [
29
+ {
30
+ "rel": "self",
31
+ "href": "https://api.tn2.paychex.com/companies/?associationid=00H2A1IUJHNG0KX092KF"
32
+ }
33
+ ]
34
+ }
35
+ ],
36
+ "links": [
37
+ {
38
+ "rel": "self",
39
+ "href": "https://api.tn2.paychex.com/companies/00H2A1IUJH6JL09DIM8A"
40
+ },
41
+ {
42
+ "rel": "workers",
43
+ "href": "https://api.tn2.paychex.com/companies/00H2A1IUJH6JL09DIM8A/workers"
44
+ }
45
+ ]
46
+ }
47
+ ]
48
+ }
@@ -30,4 +30,14 @@ describe PaychexAPI::Client::Companies do
30
30
  response = @client.get_company_workers(1)
31
31
  expect(response.first['workerId']).to(eq('00Z5V9BTIHRQF2CF7BTH'))
32
32
  end
33
+
34
+ it 'should get company associations with association type' do
35
+ response = @client.get_company_associations_by_types(1, ['LMS_ES_BPR'])
36
+ expect(response.first['associations'].length).to(eq(1))
37
+ end
38
+
39
+ it 'should get company associations filtered to empty' do
40
+ response = @client.get_company_associations_by_types(1, ['BLAH'])
41
+ expect(response.first['associations'].length).to(eq(0))
42
+ end
33
43
  end
@@ -17,4 +17,10 @@ describe PaychexAPI::Client::Users do
17
17
  expect(response.size).to eq(1)
18
18
  expect(response.first.key?('access')).to eq(true)
19
19
  end
20
+
21
+ it 'should get users workers' do
22
+ response = @client.get_user_access(1)
23
+ expect(response.size).to eq(1)
24
+ expect(response.first.key?('access')).to eq(true)
25
+ end
20
26
  end
@@ -38,6 +38,6 @@ describe PaychexAPI::Client::Workers do
38
38
 
39
39
  it 'should get a workers user' do
40
40
  response = @client.get_worker_user(1, something: 'something')
41
- expect(response.first['workerId']).to(eq('00Z5V9BTIHRQF2CF7BTH'))
41
+ expect(response.first['userId']).to(eq('00H2A1IUJ0B589F001CW'))
42
42
  end
43
43
  end
@@ -21,6 +21,15 @@ class FakePaychex < Sinatra::Base
21
21
  get_json_data 200, 'workers.json'
22
22
  end
23
23
 
24
+ get %r{/workers/\d+/users$} do
25
+ case request.env['HTTP_ACCEPT']
26
+ when "application/json;profile='http://api.paychex.com/profiles/users/v1'"
27
+ get_json_data 200, 'users.json'
28
+ else
29
+ get_json_data 200, 'workers.json'
30
+ end
31
+ end
32
+
24
33
  get %r{/workers/\d+/communications$} do
25
34
  get_json_data 200, 'communications.json'
26
35
  end
@@ -42,15 +51,21 @@ class FakePaychex < Sinatra::Base
42
51
  end
43
52
 
44
53
  # companies
45
- get %r{/companies/\d+$} do
46
- get_json_data 200, 'companies.json'
54
+
55
+ get %r{/companies/[A-Za-z0-9]+$} do
56
+ case request.env['HTTP_ACCEPT']
57
+ when "application/json;profile='http://api.paychex.com/profiles/company_associations/v1'"
58
+ get_json_data 200, 'companies_associations.json'
59
+ else
60
+ get_json_data 200, 'companies.json'
61
+ end
47
62
  end
48
63
 
49
64
  get %r{/companies$} do
50
65
  get_json_data 200, 'companies.json'
51
66
  end
52
67
 
53
- get %r{/companies/\d/organizations+$} do
68
+ get %r{/companies/[A-Za-z0-9]+/organizations+$} do
54
69
  get_json_data 200, 'organizations.json'
55
70
  end
56
71
 
@@ -70,6 +85,10 @@ class FakePaychex < Sinatra::Base
70
85
  get_json_data 200, 'users.json'
71
86
  end
72
87
 
88
+ get %r{/users/\S/workers+$} do
89
+ get_json_data 200, 'workers.json'
90
+ end
91
+
73
92
  private
74
93
 
75
94
  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.9
4
+ version: 0.0.10
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-22 00:00:00.000000000 Z
11
+ date: 2018-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -248,6 +248,7 @@ files:
248
248
  - spec/fixtures/auth.json
249
249
  - spec/fixtures/communications.json
250
250
  - spec/fixtures/companies.json
251
+ - spec/fixtures/companies_associations.json
251
252
  - spec/fixtures/messages.json
252
253
  - spec/fixtures/organizations.json
253
254
  - spec/fixtures/users.json
@@ -283,7 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
283
284
  version: '0'
284
285
  requirements: []
285
286
  rubyforge_project:
286
- rubygems_version: 2.6.14
287
+ rubygems_version: 2.7.3
287
288
  signing_key:
288
289
  specification_version: 4
289
290
  summary: Paychex API
@@ -291,6 +292,7 @@ test_files:
291
292
  - spec/fixtures/auth.json
292
293
  - spec/fixtures/communications.json
293
294
  - spec/fixtures/companies.json
295
+ - spec/fixtures/companies_associations.json
294
296
  - spec/fixtures/messages.json
295
297
  - spec/fixtures/organizations.json
296
298
  - spec/fixtures/users.json
@@ -306,4 +308,3 @@ test_files:
306
308
  - spec/paychex_api/paychex_api_spec.rb
307
309
  - spec/support/fake_paychex.rb
308
310
  - spec/test_helper.rb
309
- has_rdoc: