bobhr 0.5.13 → 0.5.16

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: f6833af093ceefa5ffbd4f56748c4cacc0abc6a9eef88a42fcf1b1ad5d00a171
4
- data.tar.gz: 863f017eb7bccf7904c060b140b5fd2c4cfbaa43b5533d4631974623342c052d
3
+ metadata.gz: 7218237ad76da3ba29c0eafa1229664858df4fc87f4fa2662b833257de0e0261
4
+ data.tar.gz: 3a10d1e11581567644956bc26bb7e2bd607bbe141fc35d2cbd5ff6f1275994fa
5
5
  SHA512:
6
- metadata.gz: 6683be064cc627dcfe6c8bb136870cbb71231034475d1b178f2a46c42944527d16371c17b24ffcdc06a84f82cc72ced0387209b12efb68bdb66de6276f9a5821
7
- data.tar.gz: b09ee6b29014ace8b434520c914c87994b2980c0da369fdb134aeb9c995c4db4e3e844945f1f969de4cbe315738d5101da0121d204932ae02159ed4bf3fe6ab1
6
+ metadata.gz: a6ea339f392621c9e064ccb1b4765884b2e462c750643aacf48db743809f07d5bb64d0c89a0c4869621267bd4ad7d88c80c1f10df0f4f764544c2fd8fc32fb5e
7
+ data.tar.gz: 04abb8208e9220ecf425300c0b0db2a3fb026a9af78aa35c7af92e55b3be1cb116a419166a2e253fd958b3abfc171f31d205849e259e9ec0a0d510a7fd924c68
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,
@@ -16,6 +16,15 @@ module Bob
16
16
  EmployeeParser.new(response).employees
17
17
  end
18
18
 
19
+ def self.all_leavers(start_date:, end_date:)
20
+ all({ includeHumanReadable: true, showInactive: true }).select do |employee|
21
+ next unless employee.internal.status == 'Inactive' && employee.internal.termination_date.present?
22
+
23
+ termination_date = Date.parse(employee.internal.termination_date)
24
+ (start_date..end_date).include?(termination_date)
25
+ end
26
+ end
27
+
19
28
  def self.all_people_managers(params = { includeHumanReadable: true })
20
29
  response = get('people', params)
21
30
  EmployeeParser.new(response).managers
@@ -2,10 +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.instance_of?(String) && k.to_i.positive?
9
10
  instance_variable_set("@#{k}", v.is_a?(Hash) ? Models::Base.new(v) : v)
10
11
  self.class.send(:define_method, k, proc { instance_variable_get("@#{k}") })
11
12
  self.class.send(:define_method, "#{k}=", proc { |val| instance_variable_set("@#{k}", val) })
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.13'
4
+ VERSION = '0.5.16'
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.13
4
+ version: 0.5.16
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-06-17 00:00:00.000000000 Z
11
+ date: 2022-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json