bobhr 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/bob/{api.rb → api/api.rb} +0 -0
- data/lib/bob/{employee → api/employee}/documents.rb +0 -0
- data/lib/bob/{employee → api/employee}/equity_grants.rb +2 -1
- data/lib/bob/{employee → api/employee}/invites.rb +0 -0
- data/lib/bob/{employee → api/employee}/salaries.rb +2 -1
- data/lib/bob/{employee → api/employee}/trainings.rb +2 -1
- data/lib/bob/{employee → api/employee}/variable_payments.rb +2 -1
- data/lib/bob/{employees.rb → api/employees.rb} +10 -7
- data/lib/bob/{metadata → api/metadata}/company_fields.rb +2 -1
- data/lib/bob/{metadata → api/metadata}/company_lists.rb +4 -2
- data/lib/bob/{metadata.rb → api/metadata.rb} +0 -0
- data/lib/bob/{onboarding_wizards.rb → api/onboarding_wizards.rb} +2 -1
- data/lib/bob/{reports.rb → api/reports.rb} +0 -0
- data/lib/bob/api/time_off.rb +20 -0
- data/lib/bob/models/base.rb +15 -0
- data/lib/bob/models/company_field.rb +6 -0
- data/lib/bob/models/company_list.rb +6 -0
- data/lib/bob/models/employee.rb +45 -0
- data/lib/bob/models/equity_grant.rb +6 -0
- data/lib/bob/models/onboarding_wizard.rb +6 -0
- data/lib/bob/models/salary.rb +9 -0
- data/lib/bob/models/time_off.rb +21 -0
- data/lib/bob/models/training.rb +6 -0
- data/lib/bob/models/variable_payment.rb +6 -0
- data/lib/bob/models.rb +12 -0
- data/lib/bob/parsers/base_parser.rb +9 -0
- data/lib/bob/parsers/company_field_parser.rb +7 -0
- data/lib/bob/parsers/company_list_parser.rb +11 -0
- data/lib/bob/parsers/employee_parser.rb +11 -0
- data/lib/bob/parsers/equity_grant_parser.rb +7 -0
- data/lib/bob/parsers/onboarding_wizard_parser.rb +7 -0
- data/lib/bob/parsers/salary_parser.rb +7 -0
- data/lib/bob/parsers/time_off_parser.rb +11 -0
- data/lib/bob/parsers/training_parser.rb +7 -0
- data/lib/bob/parsers/variable_payment_parser.rb +7 -0
- data/lib/bob/parsers.rb +12 -0
- data/lib/bob/util.rb +22 -0
- data/lib/bob/version.rb +1 -1
- data/lib/bob.rb +9 -6
- metadata +39 -16
- data/lib/bob/time_off.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7802322c3f4a72dbd2ce8b8c91a5e9a1505c4cb597ffc599c77316b4e40a1909
|
4
|
+
data.tar.gz: a037d12cbce500ccbf53affc99eceb321481dafad72503e98681a11176b8b8b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d9b871d2cb78cf68e75ca628b499237740950e95f0484c9ad1ee40ea909eccbbcad128f5730f728f01b95f832edb8e06b20cb693c27da6931bbc6ef54ab94d4
|
7
|
+
data.tar.gz: b58cb07c4851cc7d8ce37a36ff13fa99def9122efffff45cbe13054db24c6a9a4dfd4690fa4e53256ba55bfaf621e7990996f5c6126777dd64302db672d2b3ef
|
data/README.md
CHANGED
File without changes
|
File without changes
|
@@ -4,7 +4,8 @@ module Bob
|
|
4
4
|
module Employee
|
5
5
|
class EquityGrants < API
|
6
6
|
def self.all(employee_id)
|
7
|
-
get("people/#{employee_id}/equities")
|
7
|
+
response = get("people/#{employee_id}/equities")
|
8
|
+
EquityGrantParser.new(response).equity_grants
|
8
9
|
end
|
9
10
|
|
10
11
|
def self.create(employee_id, params = {})
|
File without changes
|
@@ -4,7 +4,8 @@ module Bob
|
|
4
4
|
module Employee
|
5
5
|
class Trainings < API
|
6
6
|
def self.all(employee_id)
|
7
|
-
get("people/#{employee_id}/training")
|
7
|
+
response = get("people/#{employee_id}/training")
|
8
|
+
TrainingParser.new(response).trainings
|
8
9
|
end
|
9
10
|
|
10
11
|
def self.create(employee_id, params = {})
|
@@ -4,7 +4,8 @@ module Bob
|
|
4
4
|
module Employee
|
5
5
|
class VariablePayments < API
|
6
6
|
def self.all(employee_id)
|
7
|
-
get("people/#{employee_id}/variable")
|
7
|
+
response = get("people/#{employee_id}/variable")
|
8
|
+
VariablePaymentParser.new(response).variable_payments
|
8
9
|
end
|
9
10
|
|
10
11
|
def self.create(employee_id, params = {})
|
@@ -5,20 +5,23 @@ require_relative 'employee/trainings'
|
|
5
5
|
require_relative 'employee/salaries'
|
6
6
|
require_relative 'employee/equity_grants'
|
7
7
|
require_relative 'employee/documents'
|
8
|
+
require_relative 'employee/variable_payments'
|
8
9
|
|
9
10
|
module Bob
|
10
11
|
class Employees < API
|
11
|
-
def self.all(params = {})
|
12
|
-
get('people', params)
|
12
|
+
def self.all(params = { includeHumanReadable: true })
|
13
|
+
response = get('people', params)
|
14
|
+
EmployeeParser.new(response).employees
|
13
15
|
end
|
14
16
|
|
15
|
-
def self.find(employee_id_or_email)
|
16
|
-
get("people/#{employee_id_or_email}")
|
17
|
+
def self.find(employee_id_or_email, params: { includeHumanReadable: true })
|
18
|
+
response = get("people/#{employee_id_or_email}", params)
|
19
|
+
EmployeeParser.new(response).employee
|
17
20
|
end
|
18
21
|
|
19
|
-
def self.find_by(field:, value:)
|
20
|
-
all.find do |employee|
|
21
|
-
employee
|
22
|
+
def self.find_by(field:, value:, params: { includeHumanReadable: true })
|
23
|
+
all(params).find do |employee|
|
24
|
+
employee.send(field) == value
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
@@ -4,11 +4,13 @@ module Bob
|
|
4
4
|
module MetaData
|
5
5
|
class CompanyLists < API
|
6
6
|
def self.all
|
7
|
-
get('company/named-lists')
|
7
|
+
response = get('company/named-lists')
|
8
|
+
CompanyListParser.new(response).lists
|
8
9
|
end
|
9
10
|
|
10
11
|
def self.find(list_name)
|
11
|
-
get("company/named-lists/#{list_name}")
|
12
|
+
response = get("company/named-lists/#{list_name}")
|
13
|
+
CompanyListParser.new(response).list
|
12
14
|
end
|
13
15
|
|
14
16
|
def self.add_item(list_name, params = {})
|
File without changes
|
File without changes
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bob
|
4
|
+
class TimeOff < API
|
5
|
+
def self.all_changed_since(since)
|
6
|
+
response = get('timeoff/requests/changes', { since: since })['changes']
|
7
|
+
TimeOffParser.new({ 'outs' => response }).events
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.today
|
11
|
+
response = get('timeoff/outtoday')
|
12
|
+
TimeOffParser.new(response).events
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.find_for_employee(employee_id, request_id)
|
16
|
+
response = get("timeoff/employees/#{employee_id}/requests/#{request_id}")
|
17
|
+
TimeOffParser.new(response).event
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Models
|
4
|
+
class Base
|
5
|
+
def initialize(raw)
|
6
|
+
attributes = Bob::Util.underscorize_hash(raw)
|
7
|
+
|
8
|
+
attributes.each do |k, v|
|
9
|
+
instance_variable_set("@#{k}", v.is_a?(Hash) ? Models::Base.new(v) : v)
|
10
|
+
self.class.send(:define_method, k, proc { instance_variable_get("@#{k}") })
|
11
|
+
self.class.send(:define_method, "#{k}=", proc { |val| instance_variable_set("@#{k}", val) })
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Models
|
4
|
+
class Employee < Models::Base
|
5
|
+
def manager?
|
6
|
+
work.is_manager
|
7
|
+
end
|
8
|
+
|
9
|
+
def job_title
|
10
|
+
human_readable.work.title
|
11
|
+
end
|
12
|
+
|
13
|
+
def start_date
|
14
|
+
work.start_date
|
15
|
+
end
|
16
|
+
|
17
|
+
def department
|
18
|
+
work.department
|
19
|
+
end
|
20
|
+
|
21
|
+
def division
|
22
|
+
human_readable.work.custom_columns.column_1629151319875
|
23
|
+
end
|
24
|
+
|
25
|
+
def team
|
26
|
+
human_readable.work.custom_columns.column_1642024758438
|
27
|
+
end
|
28
|
+
|
29
|
+
def entity
|
30
|
+
human_readable.work.custom_columns.column_1633980105047
|
31
|
+
end
|
32
|
+
|
33
|
+
def city
|
34
|
+
address.site_city || address.city
|
35
|
+
end
|
36
|
+
|
37
|
+
def role_level
|
38
|
+
human_readable.work.custom_columns.column_1629151373898
|
39
|
+
end
|
40
|
+
|
41
|
+
def manager
|
42
|
+
work.reports_to
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Models
|
4
|
+
class TimeOff < Models::Base
|
5
|
+
def employee
|
6
|
+
@employee ||= Bob::Employees.find(employee_id)
|
7
|
+
end
|
8
|
+
|
9
|
+
def parental_leave?
|
10
|
+
policy_type_display_name == 'Parental Leave'
|
11
|
+
end
|
12
|
+
|
13
|
+
def created?
|
14
|
+
change_type == 'Created'
|
15
|
+
end
|
16
|
+
|
17
|
+
def return_date
|
18
|
+
@return_date = Date.parse(end_date) + 1.day
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/bob/models.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'models/base'
|
4
|
+
require_relative 'models/employee'
|
5
|
+
require_relative 'models/equity_grant'
|
6
|
+
require_relative 'models/salary'
|
7
|
+
require_relative 'models/training'
|
8
|
+
require_relative 'models/variable_payment'
|
9
|
+
require_relative 'models/time_off'
|
10
|
+
require_relative 'models/company_list'
|
11
|
+
require_relative 'models/company_field'
|
12
|
+
require_relative 'models/onboarding_wizard'
|
data/lib/bob/parsers.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'parsers/base_parser'
|
4
|
+
require_relative 'parsers/employee_parser'
|
5
|
+
require_relative 'parsers/equity_grant_parser'
|
6
|
+
require_relative 'parsers/salary_parser'
|
7
|
+
require_relative 'parsers/training_parser'
|
8
|
+
require_relative 'parsers/variable_payment_parser'
|
9
|
+
require_relative 'parsers/time_off_parser'
|
10
|
+
require_relative 'parsers/company_list_parser'
|
11
|
+
require_relative 'parsers/company_field_parser'
|
12
|
+
require_relative 'parsers/onboarding_wizard_parser'
|
data/lib/bob/util.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Credits to https://github.com/myponto/ponto-ruby/blob/master/lib/ponto/util.rb
|
4
|
+
module Bob
|
5
|
+
module Util
|
6
|
+
def self.underscorize_hash(attributes)
|
7
|
+
attributes.keys.each_with_object({}) do |key, result|
|
8
|
+
result[underscore(key)] = attributes[key]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.underscore(camel_cased_word)
|
13
|
+
return camel_cased_word unless camel_cased_word =~ /[A-Z-]/
|
14
|
+
|
15
|
+
word = camel_cased_word.to_s.gsub(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
|
16
|
+
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
|
17
|
+
word.tr!('-', '_')
|
18
|
+
word.downcase!
|
19
|
+
word
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/bob/version.rb
CHANGED
data/lib/bob.rb
CHANGED
@@ -2,13 +2,16 @@
|
|
2
2
|
|
3
3
|
require_relative 'bob/version'
|
4
4
|
require_relative 'bob/configuration'
|
5
|
-
require_relative 'bob/api'
|
6
|
-
require_relative 'bob/employees'
|
7
|
-
require_relative 'bob/time_off'
|
8
|
-
require_relative 'bob/onboarding_wizards'
|
9
|
-
require_relative 'bob/metadata'
|
10
|
-
require_relative 'bob/reports'
|
5
|
+
require_relative 'bob/api/api'
|
6
|
+
require_relative 'bob/api/employees'
|
7
|
+
require_relative 'bob/api/time_off'
|
8
|
+
require_relative 'bob/api/onboarding_wizards'
|
9
|
+
require_relative 'bob/api/metadata'
|
10
|
+
require_relative 'bob/api/reports'
|
11
11
|
require_relative 'bob/webhooks'
|
12
|
+
require_relative 'bob/models'
|
13
|
+
require_relative 'bob/parsers'
|
14
|
+
require_relative 'bob/util'
|
12
15
|
|
13
16
|
module Bob
|
14
17
|
extend Configuration
|
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.
|
4
|
+
version: 0.5.0
|
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-03-
|
11
|
+
date: 2022-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -62,21 +62,44 @@ files:
|
|
62
62
|
- LICENSE.txt
|
63
63
|
- README.md
|
64
64
|
- lib/bob.rb
|
65
|
-
- lib/bob/api.rb
|
65
|
+
- lib/bob/api/api.rb
|
66
|
+
- lib/bob/api/employee/documents.rb
|
67
|
+
- lib/bob/api/employee/equity_grants.rb
|
68
|
+
- lib/bob/api/employee/invites.rb
|
69
|
+
- lib/bob/api/employee/salaries.rb
|
70
|
+
- lib/bob/api/employee/trainings.rb
|
71
|
+
- lib/bob/api/employee/variable_payments.rb
|
72
|
+
- lib/bob/api/employees.rb
|
73
|
+
- lib/bob/api/metadata.rb
|
74
|
+
- lib/bob/api/metadata/company_fields.rb
|
75
|
+
- lib/bob/api/metadata/company_lists.rb
|
76
|
+
- lib/bob/api/onboarding_wizards.rb
|
77
|
+
- lib/bob/api/reports.rb
|
78
|
+
- lib/bob/api/time_off.rb
|
66
79
|
- lib/bob/configuration.rb
|
67
|
-
- lib/bob/
|
68
|
-
- lib/bob/
|
69
|
-
- lib/bob/
|
70
|
-
- lib/bob/
|
71
|
-
- lib/bob/employee
|
72
|
-
- lib/bob/
|
73
|
-
- lib/bob/
|
74
|
-
- lib/bob/
|
75
|
-
- lib/bob/
|
76
|
-
- lib/bob/
|
77
|
-
- lib/bob/
|
78
|
-
- lib/bob/
|
79
|
-
- lib/bob/
|
80
|
+
- lib/bob/models.rb
|
81
|
+
- lib/bob/models/base.rb
|
82
|
+
- lib/bob/models/company_field.rb
|
83
|
+
- lib/bob/models/company_list.rb
|
84
|
+
- lib/bob/models/employee.rb
|
85
|
+
- lib/bob/models/equity_grant.rb
|
86
|
+
- lib/bob/models/onboarding_wizard.rb
|
87
|
+
- lib/bob/models/salary.rb
|
88
|
+
- lib/bob/models/time_off.rb
|
89
|
+
- lib/bob/models/training.rb
|
90
|
+
- lib/bob/models/variable_payment.rb
|
91
|
+
- lib/bob/parsers.rb
|
92
|
+
- lib/bob/parsers/base_parser.rb
|
93
|
+
- lib/bob/parsers/company_field_parser.rb
|
94
|
+
- lib/bob/parsers/company_list_parser.rb
|
95
|
+
- lib/bob/parsers/employee_parser.rb
|
96
|
+
- lib/bob/parsers/equity_grant_parser.rb
|
97
|
+
- lib/bob/parsers/onboarding_wizard_parser.rb
|
98
|
+
- lib/bob/parsers/salary_parser.rb
|
99
|
+
- lib/bob/parsers/time_off_parser.rb
|
100
|
+
- lib/bob/parsers/training_parser.rb
|
101
|
+
- lib/bob/parsers/variable_payment_parser.rb
|
102
|
+
- lib/bob/util.rb
|
80
103
|
- lib/bob/version.rb
|
81
104
|
- lib/bob/webhooks.rb
|
82
105
|
- lib/bobhr.rb
|
data/lib/bob/time_off.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Bob
|
4
|
-
class TimeOff < API
|
5
|
-
def self.all_changed_since(since)
|
6
|
-
get('timeoff/requests/changes', { since: since })['changes']
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.today
|
10
|
-
get('timeoff/outtoday')
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.find_for_employee(employee_id, request_id)
|
14
|
-
get("timeoff/employees/#{employee_id}/requests/#{request_id}")
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|