bobhr 0.5.27 → 0.5.29
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 +3 -1
- data/lib/bob/api/employees.rb +16 -1
- data/lib/bob/api/metadata/time_off_policies.rb +2 -2
- data/lib/bob/configuration.rb +2 -1
- data/lib/bob/models/employee.rb +1 -1
- data/lib/bob/parsers/company_list_parser.rb +1 -1
- data/lib/bob/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f50d6a3f23be5df92b26048b13dae9e8b6c566519f8ecd7611ba1a4175ba9d3
|
4
|
+
data.tar.gz: 7a71e366f4c6ba73d8fc23dbbf997fc27b2d6ac2a716b576c144a08b70922644
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43c4b4c0324c8d3fa2ff0820a7f2c294d1e50ead86115ce30b8a8c09453d7f62a545c81f82af404633304497e91b1cf62f898382b3afa55219c512dc2b2a4b76
|
7
|
+
data.tar.gz: 8bcd707124afa40ca6bc8173c568e9d36729c382ffcc8320cf7f9ba9edfdd5480aa02ec9538e6f6d3687352fb418edce1ee2f69236bee96cea1d0753e373255f
|
data/lib/bob/api/api.rb
CHANGED
@@ -9,6 +9,7 @@ require 'csv'
|
|
9
9
|
module Bob
|
10
10
|
class API
|
11
11
|
BASE_URL = 'https://api.hibob.com'
|
12
|
+
SANDBOX_URL = 'https://api.sandbox.hibob.com'
|
12
13
|
|
13
14
|
def self.get(endpoint, params = {}, csv_response: false)
|
14
15
|
url = build_url(endpoint, params)
|
@@ -86,7 +87,8 @@ module Bob
|
|
86
87
|
end
|
87
88
|
|
88
89
|
def self.build_url(endpoint, params = {})
|
89
|
-
url = "#{BASE_URL}/#{Bob.api_version}/#{endpoint}"
|
90
|
+
url = "#{BASE_URL}/#{Bob.api_version}/#{endpoint}" unless Bob.use_sandbox
|
91
|
+
url = "#{SANDBOX_URL}/#{Bob.api_version}/#{endpoint}" if Bob.use_sandbox
|
90
92
|
url += "?#{URI.encode_www_form(params)}" unless params.empty?
|
91
93
|
|
92
94
|
url
|
data/lib/bob/api/employees.rb
CHANGED
@@ -20,9 +20,24 @@ module Bob
|
|
20
20
|
|
21
21
|
def self.all_leavers(start_date:, end_date:)
|
22
22
|
all({ includeHumanReadable: true, showInactive: true }).select do |employee|
|
23
|
+
|
23
24
|
next unless employee.internal.status == 'Inactive' && employee.internal.termination_date.present?
|
24
25
|
|
25
|
-
|
26
|
+
# Don't process employees that left before the period we are looking into
|
27
|
+
internal_term_date = Date.parse(employee.internal.termination_date)
|
28
|
+
next if internal_term_date.before?(start_date)
|
29
|
+
|
30
|
+
# Need to fetch lifecycle statuses, as garden leavers have left before the actual internal term date
|
31
|
+
lifecycle_statuses = Bob::Employee::LifecycleHistory.all(employee.id)
|
32
|
+
garden_leave_status = lifecycle_statuses.find { |status| status.status == 'garden leave' }
|
33
|
+
|
34
|
+
if garden_leave_status
|
35
|
+
lifecycle_statuses = Bob::Employee::LifecycleHistory.all(employee.id)
|
36
|
+
garden_leave_status = lifecycle_statuses.find { |status| status.status == 'garden leave' }
|
37
|
+
termination_date = Date.parse(garden_leave_status.effective_date)
|
38
|
+
end
|
39
|
+
|
40
|
+
termination_date ||= Date.parse(employee.internal.termination_date)
|
26
41
|
(start_date..end_date).include?(termination_date)
|
27
42
|
end
|
28
43
|
end
|
@@ -8,12 +8,12 @@ module Bob
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.find(policy_name)
|
11
|
-
response = get(
|
11
|
+
response = get('timeoff/policies', { policyName: policy_name })
|
12
12
|
BaseParser.new(response).fields
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.names_for(policy_name)
|
16
|
-
get(
|
16
|
+
get('timeoff/policies/names', { policyTypeName: policy_name })['policies']
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/lib/bob/configuration.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Bob
|
4
4
|
module Configuration
|
5
|
-
VALID_OPTIONS_KEYS = %i[access_token access_user_name api_version api_key].freeze
|
5
|
+
VALID_OPTIONS_KEYS = %i[access_token access_user_name api_version api_key use_sandbox].freeze
|
6
6
|
attr_accessor(*VALID_OPTIONS_KEYS)
|
7
7
|
|
8
8
|
# Sets all configuration options to their default values
|
@@ -27,6 +27,7 @@ module Bob
|
|
27
27
|
self.access_token = ENV['ACCESS_TOKEN']
|
28
28
|
self.access_user_name = ENV['ACCESS_USER_NAME']
|
29
29
|
self.api_key = ENV['API_KEY']
|
30
|
+
self.use_sandbox = false
|
30
31
|
end
|
31
32
|
end
|
32
33
|
end
|
data/lib/bob/models/employee.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.29
|
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: 2023-
|
11
|
+
date: 2023-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|