bobhr 0.5.7 → 0.5.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bob/api/api.rb +41 -16
- data/lib/bob/api/employee/documents.rb +6 -2
- data/lib/bob/api/employee/work_history.rb +20 -0
- data/lib/bob/api/employees.rb +6 -0
- data/lib/bob/models/employee.rb +8 -0
- data/lib/bob/models/work_history.rb +6 -0
- data/lib/bob/models.rb +1 -0
- data/lib/bob/parsers/employee_parser.rb +6 -0
- data/lib/bob/parsers/onboarding_wizard_parser.rb +1 -1
- 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 +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 434482166e74f6e53d8d6ccd030c6198e7f669a186d96eb06c18bb8b7e9d0747
|
4
|
+
data.tar.gz: db610d2fbcb896bba33b4506e4cedb2e4922bf59c8500c6e45563864641258bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cfbb6ab9ae1324bd133837d818c537a5285a0411a7566083b14b75a8f3d92d7b9bd62a63824a69f501a2a86acbab6e748b3bc56e7d457bd7a5846de7ceede93
|
7
|
+
data.tar.gz: aa7f24c2cb908caec1fc3947432c8000a63ab21fb491c0cb202b4cf7eecf9d00fc5fc29028cce9a835e9ca32c37c730f2bc74d158399478be2fe4f2dbe100155
|
data/lib/bob/api/api.rb
CHANGED
@@ -12,46 +12,71 @@ 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
|
|
33
|
-
def self.
|
37
|
+
def self.post_file(endpoint, file)
|
34
38
|
url = build_url(endpoint)
|
35
|
-
|
39
|
+
payload = {
|
40
|
+
multipart: true,
|
41
|
+
file: file,
|
42
|
+
}
|
43
|
+
|
44
|
+
headers = {
|
45
|
+
'Content-Type': 'multipart/form-data; boundary=---011000010111000001101001',
|
46
|
+
Authorization: "Basic #{Base64.strict_encode64("#{Bob.access_user_name}:#{Bob.access_token}")}"
|
47
|
+
}
|
48
|
+
response = RestClient.post(url, payload, headers)
|
49
|
+
binding.break
|
50
|
+
p response
|
36
51
|
response.code
|
37
52
|
end
|
38
53
|
|
39
|
-
def self.
|
54
|
+
def self.delete(endpoint)
|
40
55
|
url = build_url(endpoint)
|
41
|
-
response = RestClient.
|
56
|
+
response = RestClient.delete(url)
|
42
57
|
response.code
|
43
58
|
end
|
44
59
|
|
45
|
-
def self.
|
46
|
-
|
47
|
-
|
48
|
-
|
60
|
+
def self.put(endpoint, params = {}, use_api_key: false)
|
61
|
+
url = build_url(endpoint)
|
62
|
+
response = RestClient.put(
|
63
|
+
url,
|
64
|
+
params.to_json,
|
65
|
+
authorization_header(use_api_key: use_api_key).merge(content_headers)
|
66
|
+
)
|
67
|
+
response.code
|
49
68
|
end
|
50
69
|
|
51
|
-
def self.
|
52
|
-
|
53
|
-
|
54
|
-
|
70
|
+
def self.authorization_header(use_api_key: false)
|
71
|
+
if use_api_key
|
72
|
+
{
|
73
|
+
Authorization: Bob.api_key
|
74
|
+
}
|
75
|
+
else
|
76
|
+
{
|
77
|
+
Authorization: "Basic #{Base64.strict_encode64("#{Bob.access_user_name}:#{Bob.access_token}")}"
|
78
|
+
}
|
79
|
+
end
|
55
80
|
end
|
56
81
|
|
57
82
|
def self.content_headers
|
@@ -4,11 +4,15 @@ 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
|
+
end
|
13
|
+
|
14
|
+
def self.upload_public_document(employee_id, file)
|
15
|
+
post_file("docs/people/#{employee_id}/shared/upload", file)
|
12
16
|
end
|
13
17
|
end
|
14
18
|
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
@@ -6,6 +6,7 @@ require_relative 'employee/salaries'
|
|
6
6
|
require_relative 'employee/equity_grants'
|
7
7
|
require_relative 'employee/documents'
|
8
8
|
require_relative 'employee/variable_payments'
|
9
|
+
require_relative 'employee/work_history'
|
9
10
|
|
10
11
|
module Bob
|
11
12
|
class Employees < API
|
@@ -19,6 +20,11 @@ module Bob
|
|
19
20
|
EmployeeParser.new(response).managers
|
20
21
|
end
|
21
22
|
|
23
|
+
def self.starts_on(date = Date.current.to_s, params = { includeHumanReadable: true })
|
24
|
+
response = get('people', params)
|
25
|
+
EmployeeParser.new(response).starters_on(date)
|
26
|
+
end
|
27
|
+
|
22
28
|
def self.find(employee_id_or_email, params: { includeHumanReadable: true })
|
23
29
|
response = get("people/#{employee_id_or_email}", params)
|
24
30
|
EmployeeParser.new(response).employee
|
data/lib/bob/models/employee.rb
CHANGED
@@ -34,6 +34,10 @@ module Models
|
|
34
34
|
address.site_city || address.city
|
35
35
|
end
|
36
36
|
|
37
|
+
def country
|
38
|
+
address.country || address.site_country
|
39
|
+
end
|
40
|
+
|
37
41
|
def role_level
|
38
42
|
human_readable.work.custom_columns.column_1629151373898
|
39
43
|
end
|
@@ -77,5 +81,9 @@ module Models
|
|
77
81
|
def personal_email
|
78
82
|
home.private_email
|
79
83
|
end
|
84
|
+
|
85
|
+
def linkedin_profile
|
86
|
+
human_readable.about.social_data&.linkedin
|
87
|
+
end
|
80
88
|
end
|
81
89
|
end
|
data/lib/bob/models.rb
CHANGED
@@ -14,4 +14,10 @@ class EmployeeParser < BaseParser
|
|
14
14
|
.select { |employee| employee['work']['isManager'] }
|
15
15
|
.map { |attributes| Models::Employee.new(attributes) }
|
16
16
|
end
|
17
|
+
|
18
|
+
def starters_on(date)
|
19
|
+
json_response['employees']
|
20
|
+
.select { |employee| employee['work']['startDate'] == date }
|
21
|
+
.map { |attributes| Models::Employee.new(attributes) }
|
22
|
+
end
|
17
23
|
end
|
data/lib/bob/parsers.rb
CHANGED
data/lib/bob/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lien Van Den Steen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -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
|
@@ -123,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
126
|
- !ruby/object:Gem::Version
|
124
127
|
version: '0'
|
125
128
|
requirements: []
|
126
|
-
rubygems_version: 3.
|
129
|
+
rubygems_version: 3.2.31
|
127
130
|
signing_key:
|
128
131
|
specification_version: 4
|
129
132
|
summary: Ruby gem for Bob API
|