paychex_api 0.0.10 → 0.0.11
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
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f237f7ebc68a81bea7f1fc2d5492aa1c20bf1b7d277b1d321b7f5908e17fac9
|
4
|
+
data.tar.gz: 737c9b2a6d7ce215e4288402fd8f9a1a4bf2006402c122b5e06f31edfe7e96f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a534e51810f080408d3bae4ef1a091543065f0bc8ee0a21b0e15ddad49778ba715ffafceee50961954cb1c84f5fd846cd72e375e913efaabaaa25ef2ff4270ec
|
7
|
+
data.tar.gz: '09bc8fdb11f0ab95c73a9b8f951406f403bb872674f2bd3f3ca1674027f7b614dfe69de12f915bcb172d48b097fece7d89ad042c210b1d63f1f2f06d30703d02'
|
data/Gemfile.lock
CHANGED
@@ -10,16 +10,10 @@ module PaychexAPI
|
|
10
10
|
get("#{API_PATH}#{COMPANIES_PATH}/#{company_id}", params)
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def get_company_associations_by_regex_type(company_id, regex, params = {})
|
14
14
|
connection.headers[:accept] = "application/json;profile='http://api.paychex.com/profiles/company_associations/v1'"
|
15
15
|
results = get("#{API_PATH}#{COMPANIES_PATH}/#{company_id}", params)
|
16
|
-
results
|
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
|
16
|
+
filter_associations(results, regex)
|
23
17
|
end
|
24
18
|
|
25
19
|
def get_company_workers(company_id, params = {})
|
@@ -39,6 +33,20 @@ module PaychexAPI
|
|
39
33
|
def get_organization(company_id, organization_id, params = {})
|
40
34
|
get("#{API_PATH}#{COMPANIES_PATH}/#{company_id}#{ORGANIZATIONS_PATH}/#{organization_id}", params)
|
41
35
|
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def filter_associations(results, regex)
|
40
|
+
results.members.map! do |member|
|
41
|
+
if member['associations'].present?
|
42
|
+
member['associations'] = member['associations'].select do |association|
|
43
|
+
regex.match?(association['associationType'])
|
44
|
+
end
|
45
|
+
end
|
46
|
+
member
|
47
|
+
end
|
48
|
+
results
|
49
|
+
end
|
42
50
|
end
|
43
51
|
end
|
44
52
|
end
|
data/lib/paychex_api/version.rb
CHANGED
@@ -30,14 +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
|
-
|
33
|
+
|
34
34
|
it 'should get company associations with association type' do
|
35
|
-
response = @client.
|
35
|
+
response = @client.get_company_associations_by_regex_type(1, /LMS.*/)
|
36
36
|
expect(response.first['associations'].length).to(eq(1))
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'should get company associations filtered to empty' do
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
response = @client.get_company_associations_by_regex_type(1, /BLAH.*/)
|
41
|
+
expect(response.first['associations'].length).to(eq(0))
|
42
|
+
end
|
43
43
|
end
|
@@ -13,13 +13,13 @@ describe PaychexAPI::Client::Users do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'should get users' do
|
16
|
-
response = @client.
|
16
|
+
response = @client.get_user(1)
|
17
17
|
expect(response.size).to eq(1)
|
18
18
|
expect(response.first.key?('access')).to eq(true)
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should get users workers' do
|
22
|
-
response = @client.
|
22
|
+
response = @client.get_user_workers(1)
|
23
23
|
expect(response.size).to eq(1)
|
24
24
|
expect(response.first.key?('access')).to eq(true)
|
25
25
|
end
|
@@ -22,8 +22,8 @@ class FakePaychex < Sinatra::Base
|
|
22
22
|
end
|
23
23
|
|
24
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'"
|
25
|
+
case request.env['HTTP_ACCEPT']
|
26
|
+
when "application/json;profile='http://api.paychex.com/profiles/users/v1'"
|
27
27
|
get_json_data 200, 'users.json'
|
28
28
|
else
|
29
29
|
get_json_data 200, 'workers.json'
|
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.11
|
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-
|
11
|
+
date: 2018-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|