bobhr 0.5.7 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bob/api/api.rb +24 -16
- data/lib/bob/api/employee/documents.rb +2 -2
- data/lib/bob/api/employee/work_history.rb +20 -0
- data/lib/bob/api/employees.rb +1 -0
- data/lib/bob/models/work_history.rb +6 -0
- data/lib/bob/models.rb +1 -0
- data/lib/bob/parsers/work_history_parser.rb +7 -0
- data/lib/bob/parsers.rb +1 -0
- data/lib/bob/version.rb +1 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33a9f7791ceb562c80e23dbd25dfd819178b3a0fc70ae94c51e607d1107df661
|
4
|
+
data.tar.gz: cd7d84c45ad9ed8d9e7beef7f9921402b01f7617801fa015a6c54d3b3a4ff170
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c163d409a32c041395e5e35f48f306b2ba09851395e076071737ca456ecdbc102ddd6a625ca29752bd0c5d73eb31a75715305a47da21d87ad01084eb3f70914
|
7
|
+
data.tar.gz: 5192da79cb0841b97c00499351d4bba7260e945e7860a0402559f7815e5f85b952d1a04ce06752336449c955bdfb40c44df8c4debaedc947036b1e262bb40a6d
|
data/lib/bob/api/api.rb
CHANGED
@@ -12,21 +12,25 @@ module Bob
|
|
12
12
|
|
13
13
|
def self.get(endpoint, params = {}, csv_response: false)
|
14
14
|
url = build_url(endpoint, params)
|
15
|
-
response = RestClient.get(url,
|
15
|
+
response = RestClient.get(url, authorization_header)
|
16
16
|
return create_csv(response.body) if csv_response
|
17
17
|
|
18
18
|
JSON.parse(response.body)
|
19
19
|
end
|
20
20
|
|
21
|
-
def self.post(endpoint, params = {})
|
21
|
+
def self.post(endpoint, params = {}, use_api_key: false)
|
22
22
|
url = build_url(endpoint)
|
23
|
-
response = RestClient.post(
|
23
|
+
response = RestClient.post(
|
24
|
+
url,
|
25
|
+
params.to_json,
|
26
|
+
authorization_header(use_api_key: use_api_key).merge(content_headers)
|
27
|
+
)
|
24
28
|
response.code
|
25
29
|
end
|
26
30
|
|
27
31
|
def self.post_media(endpoint, params = {})
|
28
32
|
url = build_url(endpoint)
|
29
|
-
response = RestClient.post(url, params.to_json,
|
33
|
+
response = RestClient.post(url, params.to_json, authorization_header.merge(content_headers))
|
30
34
|
response.code
|
31
35
|
end
|
32
36
|
|
@@ -36,22 +40,26 @@ module Bob
|
|
36
40
|
response.code
|
37
41
|
end
|
38
42
|
|
39
|
-
def self.put(endpoint, params = {})
|
43
|
+
def self.put(endpoint, params = {}, use_api_key: false)
|
40
44
|
url = build_url(endpoint)
|
41
|
-
response = RestClient.put(
|
45
|
+
response = RestClient.put(
|
46
|
+
url,
|
47
|
+
params.to_json,
|
48
|
+
authorization_header(use_api_key: use_api_key).merge(content_headers)
|
49
|
+
)
|
42
50
|
response.code
|
43
51
|
end
|
44
52
|
|
45
|
-
def self.
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
53
|
+
def self.authorization_header(use_api_key: false)
|
54
|
+
if use_api_key
|
55
|
+
{
|
56
|
+
Authorization: Bob.api_key
|
57
|
+
}
|
58
|
+
else
|
59
|
+
{
|
60
|
+
Authorization: "Basic #{Base64.strict_encode64("#{Bob.access_user_name}:#{Bob.access_token}")}"
|
61
|
+
}
|
62
|
+
end
|
55
63
|
end
|
56
64
|
|
57
65
|
def self.content_headers
|
@@ -4,11 +4,11 @@ module Bob
|
|
4
4
|
module Employee
|
5
5
|
class Documents < API
|
6
6
|
def self.add_public_document(employee_id, params = {})
|
7
|
-
|
7
|
+
post("docs/people/#{employee_id}/shared", params, use_api_key: true)
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.add_private_document(employee_id, params = {})
|
11
|
-
|
11
|
+
post("docs/people/#{employee_id}/confidential", params, use_api_key: true)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bob
|
4
|
+
module Employee
|
5
|
+
class WorkHistory < API
|
6
|
+
def self.all(employee_id)
|
7
|
+
response = get("people/#{employee_id}/work")
|
8
|
+
WorkHistoryParser.new(response).work_histories
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.update(employee_id, work_history_id, params)
|
12
|
+
put(
|
13
|
+
"people/#{employee_id}/work/#{work_history_id}",
|
14
|
+
params,
|
15
|
+
use_api_key: true
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/bob/api/employees.rb
CHANGED
data/lib/bob/models.rb
CHANGED
data/lib/bob/parsers.rb
CHANGED
data/lib/bob/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bobhr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lien Van Den Steen
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- lib/bob/api/employee/salaries.rb
|
70
70
|
- lib/bob/api/employee/trainings.rb
|
71
71
|
- lib/bob/api/employee/variable_payments.rb
|
72
|
+
- lib/bob/api/employee/work_history.rb
|
72
73
|
- lib/bob/api/employees.rb
|
73
74
|
- lib/bob/api/metadata.rb
|
74
75
|
- lib/bob/api/metadata/company_fields.rb
|
@@ -88,6 +89,7 @@ files:
|
|
88
89
|
- lib/bob/models/time_off.rb
|
89
90
|
- lib/bob/models/training.rb
|
90
91
|
- lib/bob/models/variable_payment.rb
|
92
|
+
- lib/bob/models/work_history.rb
|
91
93
|
- lib/bob/parsers.rb
|
92
94
|
- lib/bob/parsers/base_parser.rb
|
93
95
|
- lib/bob/parsers/company_field_parser.rb
|
@@ -99,6 +101,7 @@ files:
|
|
99
101
|
- lib/bob/parsers/time_off_parser.rb
|
100
102
|
- lib/bob/parsers/training_parser.rb
|
101
103
|
- lib/bob/parsers/variable_payment_parser.rb
|
104
|
+
- lib/bob/parsers/work_history_parser.rb
|
102
105
|
- lib/bob/util.rb
|
103
106
|
- lib/bob/version.rb
|
104
107
|
- lib/bob/webhooks.rb
|