bobhr 0.5.8 → 0.5.11

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: 33a9f7791ceb562c80e23dbd25dfd819178b3a0fc70ae94c51e607d1107df661
4
- data.tar.gz: cd7d84c45ad9ed8d9e7beef7f9921402b01f7617801fa015a6c54d3b3a4ff170
3
+ metadata.gz: 825527923439ead3067a1642f7f52a596ff1587cb282973eb427c413657e3b85
4
+ data.tar.gz: 35fd1616c04900e98536f470072c575f31ab70f8f4ebdf780ba16d466418b561
5
5
  SHA512:
6
- metadata.gz: 9c163d409a32c041395e5e35f48f306b2ba09851395e076071737ca456ecdbc102ddd6a625ca29752bd0c5d73eb31a75715305a47da21d87ad01084eb3f70914
7
- data.tar.gz: 5192da79cb0841b97c00499351d4bba7260e945e7860a0402559f7815e5f85b952d1a04ce06752336449c955bdfb40c44df8c4debaedc947036b1e262bb40a6d
6
+ metadata.gz: 5a7a574ea9c83d927509842630d0968c6ee168bc772536ba9c6c7f067f7b3bcadede9c2eed53b2d445dd0ea9be6a1cd1cfe1622ede6c65a11868e54481fa7457
7
+ data.tar.gz: e2ddd07b3d3f6bdc5d0053bd427a1d47fb03dad86a581f5652ede10bab0a7efea11dff52b4a58e689a8a43ec244b756fd0e7e60e5de33af67c0b430490d6e845
data/lib/bob/api/api.rb CHANGED
@@ -34,6 +34,23 @@ module Bob
34
34
  response.code
35
35
  end
36
36
 
37
+ def self.post_file(endpoint, file)
38
+ url = build_url(endpoint)
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
51
+ response.code
52
+ end
53
+
37
54
  def self.delete(endpoint)
38
55
  url = build_url(endpoint)
39
56
  response = RestClient.delete(url)
@@ -10,6 +10,10 @@ module Bob
10
10
  def self.add_private_document(employee_id, params = {})
11
11
  post("docs/people/#{employee_id}/confidential", params, use_api_key: true)
12
12
  end
13
+
14
+ def self.upload_public_document(employee_id, file)
15
+ post_file("docs/people/#{employee_id}/shared/upload", file)
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bob
4
+ module Employee
5
+ class LifecycleHistory < API
6
+ def self.all(employee_id)
7
+ response = get("people/#{employee_id}/lifecycle")
8
+ LifecycleHistoryParser.new(response).lifecycle_histories
9
+ end
10
+ end
11
+ end
12
+ end
@@ -7,6 +7,7 @@ require_relative 'employee/equity_grants'
7
7
  require_relative 'employee/documents'
8
8
  require_relative 'employee/variable_payments'
9
9
  require_relative 'employee/work_history'
10
+ require_relative 'employee/lifecycle_history'
10
11
 
11
12
  module Bob
12
13
  class Employees < API
@@ -20,6 +21,11 @@ module Bob
20
21
  EmployeeParser.new(response).managers
21
22
  end
22
23
 
24
+ def self.starts_on(date = Date.current.to_s, params = { includeHumanReadable: true })
25
+ response = get('people', params)
26
+ EmployeeParser.new(response).starters_on(date)
27
+ end
28
+
23
29
  def self.find(employee_id_or_email, params: { includeHumanReadable: true })
24
30
  response = get("people/#{employee_id_or_email}", params)
25
31
  EmployeeParser.new(response).employee
@@ -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
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Models
4
+ class LifecycleHistory < Models::Base
5
+ end
6
+ end
data/lib/bob/models.rb CHANGED
@@ -11,3 +11,4 @@ require_relative 'models/company_list'
11
11
  require_relative 'models/company_field'
12
12
  require_relative 'models/onboarding_wizard'
13
13
  require_relative 'models/work_history'
14
+ require_relative 'models/lifecycle_history'
@@ -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
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class LifecycleHistoryParser < BaseParser
4
+ def lifecycle_histories
5
+ json_response['values'].map { |attributes| Models::LifecycleHistory.new(attributes) }
6
+ end
7
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  class OnboardingWizardParser < BaseParser
4
4
  def wizards
5
- json_response['values'].map { |attributes| Models::OnboardingWizard.new(attributes) }
5
+ json_response['wizards'].map { |attributes| Models::OnboardingWizard.new(attributes) }
6
6
  end
7
7
  end
data/lib/bob/parsers.rb CHANGED
@@ -11,3 +11,4 @@ require_relative 'parsers/company_list_parser'
11
11
  require_relative 'parsers/company_field_parser'
12
12
  require_relative 'parsers/onboarding_wizard_parser'
13
13
  require_relative 'parsers/work_history_parser'
14
+ require_relative 'parsers/lifecycle_history_parser'
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.8'
4
+ VERSION = '0.5.11'
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.8
4
+ version: 0.5.11
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-04-08 00:00:00.000000000 Z
11
+ date: 2022-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -66,6 +66,7 @@ files:
66
66
  - lib/bob/api/employee/documents.rb
67
67
  - lib/bob/api/employee/equity_grants.rb
68
68
  - lib/bob/api/employee/invites.rb
69
+ - lib/bob/api/employee/lifecycle_history.rb
69
70
  - lib/bob/api/employee/salaries.rb
70
71
  - lib/bob/api/employee/trainings.rb
71
72
  - lib/bob/api/employee/variable_payments.rb
@@ -84,6 +85,7 @@ files:
84
85
  - lib/bob/models/company_list.rb
85
86
  - lib/bob/models/employee.rb
86
87
  - lib/bob/models/equity_grant.rb
88
+ - lib/bob/models/lifecycle_history.rb
87
89
  - lib/bob/models/onboarding_wizard.rb
88
90
  - lib/bob/models/salary.rb
89
91
  - lib/bob/models/time_off.rb
@@ -96,6 +98,7 @@ files:
96
98
  - lib/bob/parsers/company_list_parser.rb
97
99
  - lib/bob/parsers/employee_parser.rb
98
100
  - lib/bob/parsers/equity_grant_parser.rb
101
+ - lib/bob/parsers/lifecycle_history_parser.rb
99
102
  - lib/bob/parsers/onboarding_wizard_parser.rb
100
103
  - lib/bob/parsers/salary_parser.rb
101
104
  - lib/bob/parsers/time_off_parser.rb
@@ -126,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
129
  - !ruby/object:Gem::Version
127
130
  version: '0'
128
131
  requirements: []
129
- rubygems_version: 3.3.7
132
+ rubygems_version: 3.2.31
130
133
  signing_key:
131
134
  specification_version: 4
132
135
  summary: Ruby gem for Bob API