bobhr 0.5.14 → 0.5.17

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: a20c0745a84b5e37e77621a9a2763add4a7eac30416f00846c86300920bba425
4
- data.tar.gz: 1177e6df4144020f139592e3f39591ac3bde0a212b353a1e100b26c62f9dc74a
3
+ metadata.gz: 0bfc372aea38224844d0bbb70a15fa25b688724e714836d451d39e9f543c1577
4
+ data.tar.gz: 1cabe3c271b8f048c63294a672bf15e03e20bb725d5fe8d7871785f001a42df0
5
5
  SHA512:
6
- metadata.gz: fb4a4fa0fcf022f1d36c8ed5d5f8de745a7c57b44dd5e1e792c53f9b6185a9361c4f67c2c48492743662ddbc4e6264c2fa77153516c5d79f5e0729abe2f8a7e2
7
- data.tar.gz: ec53c213c5eb300d5081a7a44e9e074d605111645a9a93783e3380b976f149c0b67e5de7a20e8ecc9d068682dd3ba67ada6ecaeb490e86f489b4d74846012865
6
+ metadata.gz: 15f51d9c32b5f04da13b268f7ef5b08b384fa8f62f139b555ecf1f22f218f7cd8fc2e953457b2507369e122a29cc712ab508990c3b22d4ede96c557a56556da2
7
+ data.tar.gz: 73ff2e831eb14fe256bee2016e1afab2b312536795d5b97b597cceb18d6c2ffc72ca39ddc3ee27822132a84bc73475d5c8c4a856c5d89ad0616fbd1f3280a494
data/lib/bob/api/api.rb CHANGED
@@ -34,7 +34,7 @@ module Bob
34
34
  response.code
35
35
  end
36
36
 
37
- def self.post_file(endpoint, file_path)
37
+ def self.post_file(endpoint, file_path) # rubocop:disable Metrics/MethodLength
38
38
  url = build_url(endpoint)
39
39
  payload = {
40
40
  multipart: true,
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bob
4
+ module Employee
5
+ class TimeOff < API
6
+ def self.balance(employee_id:, policy_type:, date: )
7
+ response = get("timeoff/employees/#{employee_id}/balance", {policyType: policy_type, date: date})
8
+ BaseParser.new(response).fields
9
+ end
10
+ end
11
+ end
12
+ end
@@ -8,6 +8,7 @@ require_relative 'employee/documents'
8
8
  require_relative 'employee/variable_payments'
9
9
  require_relative 'employee/work_history'
10
10
  require_relative 'employee/lifecycle_history'
11
+ require_relative 'employee/time_off'
11
12
 
12
13
  module Bob
13
14
  class Employees < API
@@ -16,6 +17,15 @@ module Bob
16
17
  EmployeeParser.new(response).employees
17
18
  end
18
19
 
20
+ def self.all_leavers(start_date:, end_date:)
21
+ all({ includeHumanReadable: true, showInactive: true }).select do |employee|
22
+ next unless employee.internal.status == 'Inactive' && employee.internal.termination_date.present?
23
+
24
+ termination_date = Date.parse(employee.internal.termination_date)
25
+ (start_date..end_date).include?(termination_date)
26
+ end
27
+ end
28
+
19
29
  def self.all_people_managers(params = { includeHumanReadable: true })
20
30
  response = get('people', params)
21
31
  EmployeeParser.new(response).managers
@@ -2,11 +2,11 @@
2
2
 
3
3
  module Models
4
4
  class Base
5
- def initialize(raw)
5
+ def initialize(raw) # rubocop:disable Metrics/AbcSize
6
6
  attributes = Bob::Util.underscorize_hash(raw)
7
7
 
8
8
  attributes.each do |k, v|
9
- k = "field_#{k}" if k.to_i > 0
9
+ k = "field_#{k}" if k.instance_of?(String) && k.to_i.positive?
10
10
  instance_variable_set("@#{k}", v.is_a?(Hash) ? Models::Base.new(v) : v)
11
11
  self.class.send(:define_method, k, proc { instance_variable_get("@#{k}") })
12
12
  self.class.send(:define_method, "#{k}=", proc { |val| instance_variable_set("@#{k}", val) })
@@ -6,4 +6,8 @@ class BaseParser
6
6
  def initialize(json_response)
7
7
  @json_response = json_response
8
8
  end
9
+
10
+ def fields
11
+ Models::Base.new(json_response)
12
+ end
9
13
  end
data/lib/bob/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bob
4
- VERSION = '0.5.14'
4
+ VERSION = '0.5.17'
5
5
  end
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.14
4
+ version: 0.5.17
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-07-26 00:00:00.000000000 Z
11
+ date: 2022-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -68,6 +68,7 @@ files:
68
68
  - lib/bob/api/employee/invites.rb
69
69
  - lib/bob/api/employee/lifecycle_history.rb
70
70
  - lib/bob/api/employee/salaries.rb
71
+ - lib/bob/api/employee/time_off.rb
71
72
  - lib/bob/api/employee/trainings.rb
72
73
  - lib/bob/api/employee/variable_payments.rb
73
74
  - lib/bob/api/employee/work_history.rb
@@ -129,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
130
  - !ruby/object:Gem::Version
130
131
  version: '0'
131
132
  requirements: []
132
- rubygems_version: 3.3.7
133
+ rubygems_version: 3.2.31
133
134
  signing_key:
134
135
  specification_version: 4
135
136
  summary: Ruby gem for Bob API