bobhr 0.1.0 → 0.1.1

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: c3a576e62ca3b77d88283be9e4a13b77c4196c99ae9d4a1eab96373fe09bdcae
4
- data.tar.gz: fe774f30c3c845d81dfbe8f0da3857cc1055f9938539fe3abd43b18898a279be
3
+ metadata.gz: e749360430dece90bd974b8089dcab5df02e67c6bacb2d6357d233fbc7f32bad
4
+ data.tar.gz: a92067aaa2464ce1687bf8291920af2887106a2d3bce4da4fb5f393bbac8bfdf
5
5
  SHA512:
6
- metadata.gz: d4812690e91027a4afd886da2fc6b6eba6f743018ba05a86a909d6ed209c8847967a1b9a4b2fbdeb2f1744e1508913449f7d2fbaebe3f511c521402c87598060
7
- data.tar.gz: dce2b58367cf53b8d263c911e475d174dff6b4d071ce845d7b4dbbef4c6cfbaee44f447f61557e2a4b6c3fae030ba71f2e15987c547789af32e23f3b1e66ae75
6
+ metadata.gz: 6f821ab2f568e5ebc2850b83d3523cbcb85c738045b689c8ec7963aee8b5a002e7d55cadc619f4bc6ad9bc53c934ece7780adcc1141f56aa32aa083584f7bfff
7
+ data.tar.gz: 5b539cc092cb32b00f728e2a02531da12b50a554aee9f14427e726a351e362da35d30072eacb175edd5cb10de3f6e103986e5f7fbf5fcc400a84cc2d980500cc
data/.rubocop.yml CHANGED
@@ -1,5 +1,9 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
+ require:
4
+ - rubocop-rspec
5
+ - rubocop-rake
6
+
3
7
  AllCops:
4
8
  TargetRubyVersion: 3.0
5
9
  NewCops: enable
data/.rubocop_todo.yml CHANGED
@@ -1,11 +1,38 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2021-11-17 13:12:47 UTC using RuboCop version 1.23.0.
3
+ # on 2021-11-22 15:47:01 UTC using RuboCop version 1.23.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
+ # Offense count: 1
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
12
+ # Include: **/*.gemfile, **/Gemfile, **/gems.rb
13
+ Bundler/OrderedGems:
14
+ Exclude:
15
+ - 'Gemfile'
16
+
17
+ # Offense count: 2
18
+ # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
19
+ # Include: **/*_spec*rb*, **/spec/**/*
20
+ RSpec/FilePath:
21
+ Exclude:
22
+ - 'spec/api_spec.rb'
23
+ - 'spec/employees_spec.rb'
24
+
25
+ # Offense count: 1
26
+ RSpec/MultipleExpectations:
27
+ Max: 2
28
+
29
+ # Offense count: 2
30
+ # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
31
+ RSpec/VerifiedDoubles:
32
+ Exclude:
33
+ - 'spec/api_spec.rb'
34
+ - 'spec/employees_spec.rb'
35
+
9
36
  # Offense count: 1
10
37
  # Configuration parameters: AllowedMethods.
11
38
  # AllowedMethods: respond_to_missing?
data/Gemfile CHANGED
@@ -10,3 +10,5 @@ gem 'rake', '~> 13.0'
10
10
  gem 'rspec', '~> 3.0'
11
11
 
12
12
  gem 'rubocop', '~> 1.7'
13
+ gem 'rubocop-rspec', require: false
14
+ gem 'rubocop-rake', require: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bobhr (0.1.0)
4
+ bobhr (0.1.1)
5
5
  json
6
6
  rest-client (~> 2.0)
7
7
 
@@ -56,6 +56,10 @@ GEM
56
56
  unicode-display_width (>= 1.4.0, < 3.0)
57
57
  rubocop-ast (1.13.0)
58
58
  parser (>= 3.0.1.1)
59
+ rubocop-rake (0.6.0)
60
+ rubocop (~> 1.0)
61
+ rubocop-rspec (2.6.0)
62
+ rubocop (~> 1.19)
59
63
  ruby-progressbar (1.11.0)
60
64
  unf (0.1.4)
61
65
  unf_ext
@@ -70,6 +74,8 @@ DEPENDENCIES
70
74
  rake (~> 13.0)
71
75
  rspec (~> 3.0)
72
76
  rubocop (~> 1.7)
77
+ rubocop-rake
78
+ rubocop-rspec
73
79
 
74
80
  BUNDLED WITH
75
- 2.2.22
81
+ 2.2.31
data/README.md CHANGED
@@ -1,12 +1,14 @@
1
1
  # Bob
2
2
 
3
- Bob is a Ruby wrapper and CLI for the [Bob API](https://apidocs.hibob.com/).
3
+ Bob is a Ruby wrapper and CLI for the [Bob API](https://apidocs.hibob.com/). To interact with this Ruby gem you need
4
+ access to Bob.
5
+
4
6
  ## Installation
5
7
 
6
8
  Add this line to your application's Gemfile:
7
9
 
8
10
  ```ruby
9
- gem 'bob'
11
+ gem 'bobhr'
10
12
  ```
11
13
 
12
14
  And then execute:
@@ -15,16 +17,19 @@ And then execute:
15
17
 
16
18
  Or install it yourself as:
17
19
 
18
- $ gem install bob
20
+ $ gem install bobhr
19
21
 
20
22
  ## Usage
21
23
 
24
+ Create a Service User in Bob and use the ID and token to configure the client.
25
+
22
26
  Configuration example:
23
27
 
24
28
  ```ruby
25
29
 
26
30
  Bob.configure do |config|
27
31
  config.access_token = 'your-access-token'
32
+ config.access_user_name = 'your-access-user-name'
28
33
  end
29
34
  ```
30
35
 
@@ -33,7 +38,8 @@ Usage examples:
33
38
  ```ruby
34
39
 
35
40
  Bob.access_token = 'your-access-token'
36
-
41
+ employee = Bob::Employees.find(1)
42
+ employee_trainings = Bob::Employees::Trainings.all(1)
37
43
  ```
38
44
 
39
45
  ## Development
data/lib/bob/api.rb CHANGED
@@ -15,12 +15,37 @@ module Bob
15
15
  JSON.parse(response.body)
16
16
  end
17
17
 
18
+ def self.post(endpoint, params = {})
19
+ url = build_url(endpoint)
20
+ response = RestClient.post(url, params.to_json, headers.merge(content_headers))
21
+ response.code
22
+ end
23
+
24
+ def self.delete(endpoint)
25
+ url = build_url(endpoint)
26
+ response = RestClient.delete(url)
27
+ response.code
28
+ end
29
+
30
+ def self.put(endpoint, params = {})
31
+ url = build_url(endpoint)
32
+ response = RestClient.put(url, params.to_json, headers.merge(content_headers))
33
+ response.code
34
+ end
35
+
18
36
  def self.headers
19
37
  {
20
38
  Authorization: "Basic #{Base64.strict_encode64("#{Bob.access_user_name}:#{Bob.access_token}")}"
21
39
  }
22
40
  end
23
41
 
42
+ def self.content_headers
43
+ {
44
+ Accept: 'application/json',
45
+ 'Content-Type': 'application/json'
46
+ }
47
+ end
48
+
24
49
  def self.build_url(endpoint, params = {})
25
50
  url = "#{BASE_URL}/#{Bob.api_version}/#{endpoint}"
26
51
  url += "?#{URI.encode_www_form(params)}" unless params.empty?
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bob
4
+ module Employee
5
+ class Documents < API
6
+ def self.add_public_document(employee_id, params = {})
7
+ post("docs/people/#{employee_id}/shared", params)
8
+ end
9
+
10
+ def self.add_private_document(employee_id, params = {})
11
+ post("docs/people/#{employee_id}/confidential", params)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bob
4
+ module Employee
5
+ class EquityGrants < API
6
+ def self.all(employee_id)
7
+ get("people/#{employee_id}/equities")
8
+ end
9
+
10
+ def self.create(employee_id, params = {})
11
+ post("people/#{employee_id}/equities", params)
12
+ end
13
+
14
+ def self.remove(employee_id, entry_id)
15
+ delete("people/#{employee_id}/salaries/#{entry_id}")
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bob
4
+ module Employee
5
+ class Invites < API
6
+ def self.send(employee_id, wizard_id)
7
+ post("employees/#{employee_id}/invitations", { welcomeWizardId: wizard_id })
8
+ end
9
+
10
+ def self.revoke(employee_id)
11
+ post("employees/#{employee_id}/uninvite")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bob
4
+ module Employee
5
+ class Salaries < API
6
+ def self.all(employee_id)
7
+ get("people/#{employee_id}/salaries")
8
+ end
9
+
10
+ def self.create(employee_id, params = {})
11
+ post("people/#{employee_id}/salaries", params)
12
+ end
13
+
14
+ def self.remove(employee_id, salary_id)
15
+ delete("people/#{employee_id}/salaries/#{salary_id}")
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bob
4
+ module Employee
5
+ class Trainings < API
6
+ def self.all(employee_id)
7
+ get("people/#{employee_id}/training")
8
+ end
9
+
10
+ def self.create(employee_id, params = {})
11
+ post("people/#{employee_id}/training", params)
12
+ end
13
+
14
+ def self.remove(employee_id, training_id)
15
+ delete("people/#{employee_id}/training/#{training_id}")
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bob
4
+ module Employee
5
+ class VariablePayments < API
6
+ def self.all(employee_id)
7
+ get("people/#{employee_id}/variable")
8
+ end
9
+
10
+ def self.create(employee_id, params = {})
11
+ post("people/#{employee_id}/variable", params)
12
+ end
13
+ end
14
+ end
15
+ end
data/lib/bob/employees.rb CHANGED
@@ -1,13 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'employee/invites'
4
+ require_relative 'employee/trainings'
5
+ require_relative 'employee/salaries'
6
+ require_relative 'employee/equity_grants'
7
+ require_relative 'employee/documents'
8
+
3
9
  module Bob
4
10
  class Employees < API
5
11
  def self.all(params = {})
6
12
  get('people', params)
7
13
  end
8
14
 
9
- def self.find(id_or_email)
10
- get("people/#{id_or_email}")
15
+ def self.find(employee_id_or_email)
16
+ get("people/#{employee_id_or_email}")
17
+ end
18
+
19
+ # start date needs to be in ISO format
20
+ def self.update_start_date(employee_id, start_date)
21
+ post("employees/#{employee_id}", { startDate: start_date })
22
+ end
23
+
24
+ def self.update_email(employee_id, email)
25
+ put("people/#{employee_id}/email", { email: email })
11
26
  end
12
27
  end
13
28
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bob
4
+ module MetaData
5
+ class CompanyFields < API
6
+ def self.all
7
+ get('company/people/fields')
8
+ end
9
+
10
+ def self.create(params = {})
11
+ post('company/people/fields', params)
12
+ end
13
+
14
+ def self.update(field_id, params = {})
15
+ put("company/people/fields/#{field_id}", params)
16
+ end
17
+
18
+ def self.remove(field_id)
19
+ delete("company/people/fields/#{field_id}")
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bob
4
+ module MetaData
5
+ class CompanyLists < API
6
+ def self.all
7
+ get('company/named-lists')
8
+ end
9
+
10
+ def self.find(list_name)
11
+ get("company/named-lists/#{list_name}")
12
+ end
13
+
14
+ def self.add_item(list_name, params = {})
15
+ post("company/named-lists/#{list_name}", params)
16
+ end
17
+
18
+ def self.update_item(list_name, item_id, params = {})
19
+ put("company/named-lists/#{list_name}/#{item_id}", params)
20
+ end
21
+
22
+ def self.remove_item(list_name, item_id)
23
+ delete("company/named-lists/#{list_name}/#{item_id}")
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'metadata/company_lists'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bob
4
+ class OnboardingWizards < API
5
+ def self.all
6
+ get('onboarding/wizards')
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,13 @@
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 })
7
+ end
8
+
9
+ def self.today
10
+ get('timeoff/outtoday')
11
+ end
12
+ end
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.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
data/lib/bob.rb CHANGED
@@ -4,6 +4,9 @@ require_relative 'bob/version'
4
4
  require_relative 'bob/configuration'
5
5
  require_relative 'bob/api'
6
6
  require_relative 'bob/employees'
7
+ require_relative 'bob/time_off'
8
+ require_relative 'bob/onboarding_wizards'
9
+ require_relative 'bob/metadata'
7
10
 
8
11
  module Bob
9
12
  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.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lien Van Den Steen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-17 00:00:00.000000000 Z
11
+ date: 2021-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -60,13 +60,23 @@ files:
60
60
  - Rakefile
61
61
  - bin/console
62
62
  - bin/setup
63
- - bob-0.1.0.gem
64
63
  - bob.gemspec
65
64
  - exe/bob
66
65
  - lib/bob.rb
67
66
  - lib/bob/api.rb
68
67
  - lib/bob/configuration.rb
68
+ - lib/bob/employee/documents.rb
69
+ - lib/bob/employee/equity_grants.rb
70
+ - lib/bob/employee/invites.rb
71
+ - lib/bob/employee/salaries.rb
72
+ - lib/bob/employee/trainings.rb
73
+ - lib/bob/employee/variable_payments.rb
69
74
  - lib/bob/employees.rb
75
+ - lib/bob/metadata.rb
76
+ - lib/bob/metadata/company_fields.rb
77
+ - lib/bob/metadata/company_lists.rb
78
+ - lib/bob/onboarding_wizards.rb
79
+ - lib/bob/time_off.rb
70
80
  - lib/bob/version.rb
71
81
  homepage: https://github.com/lienvdsteen/bob
72
82
  licenses:
@@ -88,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
98
  - !ruby/object:Gem::Version
89
99
  version: '0'
90
100
  requirements: []
91
- rubygems_version: 3.2.22
101
+ rubygems_version: 3.2.31
92
102
  signing_key:
93
103
  specification_version: 4
94
104
  summary: Ruby gem for Bob API
data/bob-0.1.0.gem DELETED
Binary file