peoplegroup-hris 0.1.1 → 0.2.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: af2fbb3f87a48810923818791b9f64806dee057252b94823d468a2fac71d17c3
4
- data.tar.gz: 4a8ce9cdeda8f15c441d6f1380b2f3c4b2723f3131205b40e5408407e82be8e3
3
+ metadata.gz: ad00f80343d9b8c28dc59f79c3987ae545dde5daf37a2721cf20c0d0e393d068
4
+ data.tar.gz: 57bf0e92a25665313dd488cbc018545577f7018a8ca60beacf2efa0a817c020e
5
5
  SHA512:
6
- metadata.gz: c5d4b55b17e3edfa6973a19fae9a01e7f812101346bccf16a7adcf80cd100db07008d0ddfb5fe95f6b7d672dd72d7dacc333ae22dc308a1c722ff774a642a267
7
- data.tar.gz: a012fa65e9616a58437f8a9f15bc5863123d050cddf2241079583b3e9a661ce6408abab8e1885d232ac58f811a2c586b892022e64e13456665ce47a78c6a5e3f
6
+ metadata.gz: 18fd74fcaa908147a9c28df1b72aad73688c21b56a35ae5e59b773ca7f2377e4fd2933525e5938646d3b11024fda40e5f5201e884b55b2ab79d0fe8a8ddb2e36
7
+ data.tar.gz: 8e566c2530c2a06e7fa87e1ffbeca4ff543c254f0469e2aba467370334490377a0d8c3af0eeea4c753a7fcf1feae8a67a8faebf0c27781b6359b3649d48fdfa7
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Peoplegroup::Hris
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/peoplegroup/hris`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ This Ruby library is a wrapper over our HRIS. If we'd switch systems,
4
+ we could easily do so by adding a new class that inherits from the HRTool
5
+ class.
6
6
 
7
7
  ## Installation
8
8
 
@@ -22,7 +22,15 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
25
+ ```ruby
26
+ require 'peoplegroup/hris'
27
+ PeopleGroup::HRIS.configure do |config|
28
+ config.hris_client = PeopleGroup::HRIS::BambooHR
29
+ end
30
+
31
+ all_team_members = PeopleGroup::HRIS::TeamMembers.all
32
+ all_active_team_members = PeopleGroup::HRIS::TeamMembers.active_and_current
33
+ ```
26
34
 
27
35
  ## Development
28
36
 
@@ -32,7 +40,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
40
 
33
41
  ## Contributing
34
42
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/peoplegroup-hris. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/peoplegroup-hris/blob/master/CODE_OF_CONDUCT.md).
43
+ Bug reports and merge requests are welcome on GitLab at https://gitlab.com/gitlab-com/people-group/peopleops-eng/hris-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://gitlab.com/gitlab-com/people-group/peopleops-eng/hris-ruby/-/blob/main/CODE_OF_CONDUCT.md).
36
44
 
37
45
  ## License
38
46
 
@@ -40,4 +48,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
40
48
 
41
49
  ## Code of Conduct
42
50
 
43
- Everyone interacting in the Peoplegroup::Hris project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/peoplegroup-hris/blob/master/CODE_OF_CONDUCT.md).
51
+ Everyone interacting in the Peoplegroup::Hris project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://gitlab.com/gitlab-com/people-group/peopleops-eng/hris-ruby/-/blob/main/CODE_OF_CONDUCT.md).
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "hr_tool"
4
+ require_relative 'wrappers/mock_team_member'
5
+
6
+ module PeopleGroup
7
+ module HRIS
8
+ class HRISMock < HRTool
9
+ def self.all
10
+ @@all ||= PeopleGroup::HRIS.configuration.mock_data
11
+ end
12
+
13
+ def self.map_to_team_member(data)
14
+ # TODO: check what client is used
15
+ PeopleGroup::HRIS::Wrappers::MockTeamMember.new(data)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -19,7 +19,7 @@ module PeopleGroup
19
19
  private
20
20
 
21
21
  def self.hr_tool
22
- BambooHR # TODO can we set this on config
22
+ PeopleGroup::HRIS.configuration.hris_client
23
23
  end
24
24
  end
25
25
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Peoplegroup
4
- module Hris
5
- VERSION = "0.1.1"
4
+ module HRIS
5
+ VERSION = "0.2.1"
6
6
  end
7
7
  end
@@ -0,0 +1,58 @@
1
+ require_relative 'team_member'
2
+
3
+ module PeopleGroup
4
+ module HRIS
5
+ module Wrappers
6
+ class MockTeamMember < TeamMember
7
+ def initialize(data)
8
+ @data = data
9
+ end
10
+
11
+ MAPPED_ITEMS = ['department', 'division']
12
+ MAPPED_ITEMS.each do |item|
13
+ define_method("#{item}") do
14
+ @data[item]
15
+ end
16
+ end
17
+
18
+ def team_member_id
19
+ @data['id']
20
+ end
21
+
22
+ def first_name
23
+ @data['preferredName'] || @data['firstName']
24
+ end
25
+
26
+ def last_name
27
+ @data['customPreferredLastName'] || @data['lastName']
28
+ end
29
+
30
+ def active?
31
+ @data['status'] == 'Active'
32
+ end
33
+
34
+ def start_date
35
+ return unless @data['hireDate']
36
+
37
+ Date.parse(@data['hireDate'])
38
+ end
39
+
40
+ def specialties
41
+ @data['customJobTitleSpecialty(Multi-Select)'] || @data['customJobTitleSpeciality'] || ''
42
+ end
43
+
44
+ def gitlab_username
45
+ @data['customGitLabUsername']
46
+ end
47
+
48
+ def work_email
49
+ @data['workEmail']
50
+ end
51
+
52
+ def offboarded?
53
+ false
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -3,9 +3,16 @@
3
3
  require_relative "hris/version"
4
4
  require_relative "hris/team_members"
5
5
  require_relative "hris/bamboo_hr"
6
+ require_relative "hris/hris_mock"
6
7
 
7
- module Peoplegroup
8
+ module PeopleGroup
8
9
  module HRIS
9
- class Error < StandardError; end
10
+ def self.configuration
11
+ @configuration ||= OpenStruct.new
12
+ end
13
+
14
+ def self.config
15
+ yield(configuration)
16
+ end
10
17
  end
11
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peoplegroup-hris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.1
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: 2021-07-30 00:00:00.000000000 Z
11
+ date: 2021-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bamboozled-gitlab
@@ -120,9 +120,11 @@ files:
120
120
  - lib/peoplegroup/hris.rb
121
121
  - lib/peoplegroup/hris/bamboo_hr.rb
122
122
  - lib/peoplegroup/hris/hr_tool.rb
123
+ - lib/peoplegroup/hris/hris_mock.rb
123
124
  - lib/peoplegroup/hris/team_members.rb
124
125
  - lib/peoplegroup/hris/version.rb
125
126
  - lib/peoplegroup/hris/wrappers/bamboo_team_member.rb
127
+ - lib/peoplegroup/hris/wrappers/mock_team_member.rb
126
128
  - lib/peoplegroup/hris/wrappers/team_member.rb
127
129
  homepage: https://gitlab.com/gitlab-com/people-group/peopleops-eng/hris-gem'
128
130
  licenses: