peoplegroup-hris 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 57dcac72a80f8b12dfaf75e63f1756ff53c1d9188220e8272fd08b0ddbb34a04
4
+ data.tar.gz: 64f37272850f9bd2e2e6cea2b5a5dd57d897a800e827aa3851547572959c8340
5
+ SHA512:
6
+ metadata.gz: c0321306d4c9b6b75b72f6cccb3f9a51c5d514be9f70a3b888150fc1a1f883f0d08a3595076ebb38a321268350bb53360ab849bea8f779dc7e38db2f2944c955
7
+ data.tar.gz: 2ab6f07293fef1cc33c219d29d632292b8cb2257c8aea29ac442642163879f9ba31c736f5bd456b8036359cc3ec4f628bc5738296a38c6ed1a7363034b89867f
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 lien van den steen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Peoplegroup::Hris
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
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'peoplegroup-hris'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install peoplegroup-hris
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
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).
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
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).
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "hris/version"
4
+ require_relative "hris/team_members"
5
+ require_relative "hris/bamboo_hr"
6
+
7
+ module Peoplegroup
8
+ module HRIS
9
+ class Error < StandardError; end
10
+ end
11
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bamboozled'
4
+ require_relative "hr_tool"
5
+
6
+ module PeopleGroup
7
+ module HRIS
8
+ class BambooHR < HRTool
9
+ def self.all
10
+ @@fields ||= (Bamboozled::API::FieldCollection.all_names + client.meta.fields.map { |f| f['alias'] }).compact.uniq
11
+ @@fields.delete('flsaCode') # temp fix for problems with BambooHR
12
+ @@all ||= client.report.custom(@@fields, 'JSON').reject { |employee| employee['lastName'] == 'Test-Gitlab' }
13
+ end
14
+
15
+ def self.map_to_team_member(data)
16
+ team_member = TeamMember.new
17
+ team_member.department = data['department']
18
+ team_member.division = data['division']
19
+ team_member.first_name = data['preferredName'] || data['firstName']
20
+ team_member.last_name = data['customPreferredLastName'] || data['lastName']
21
+ team_member.full_name = "#{team_member.first_name} #{team_member.last_name}"
22
+ team_member.active = data['status'] == 'Active'
23
+ team_member
24
+ end
25
+
26
+ private
27
+
28
+ def self.client
29
+ @@client ||= Bamboozled.client(subdomain: ENV['BAMBOO_SUBDOMAIN'], api_key: ENV['BAMBOO_API_KEY'])
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PeopleGroup
4
+ module HRIS
5
+ class HRTool
6
+ TeamMember = Struct.new(:department, :division, :first_name, :last_name, :full_name, :active)
7
+
8
+ def self.all
9
+ raise NotImplementedError
10
+ end
11
+
12
+ def self.all_active
13
+ raise NotImplementedError
14
+ end
15
+
16
+ def self.map_to_team_member(data)
17
+ raise NotImplementedError
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PeopleGroup
4
+ module HRIS
5
+ class TeamMembers
6
+ def self.all
7
+ @@all ||= hr_tool.all.map! { |data| hr_tool.map_to_team_member(data) }
8
+ end
9
+
10
+ def self.all_active
11
+ all.select { |team_member| team_member.active }
12
+ end
13
+
14
+ private
15
+
16
+ def self.hr_tool
17
+ BambooHR
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Peoplegroup
4
+ module Hris
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: peoplegroup-hris
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Lien Van Den Steen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-07-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bamboozled-gitlab
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.2.12
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.2.12
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.2'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.91.1
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.91.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: gitlab-styles
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '6.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '6.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-packaging
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.1'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.39'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.39'
97
+ - !ruby/object:Gem::Dependency
98
+ name: dotenv-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description:
112
+ email:
113
+ - lvandensteen@gitlab.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - LICENSE.txt
119
+ - README.md
120
+ - lib/peoplegroup/hris.rb
121
+ - lib/peoplegroup/hris/bamboo_hr.rb
122
+ - lib/peoplegroup/hris/hr_tool.rb
123
+ - lib/peoplegroup/hris/team_members.rb
124
+ - lib/peoplegroup/hris/version.rb
125
+ homepage: https://gitlab.com/gitlab-com/people-group/peopleops-eng/hris-gem'
126
+ licenses:
127
+ - MIT
128
+ metadata:
129
+ homepage_uri: https://gitlab.com/gitlab-com/people-group/peopleops-eng/hris-gem'
130
+ source_code_uri: https://gitlab.com/gitlab-com/people-group/peopleops-eng/hris-gem'
131
+ changelog_uri: https://gitlab.com/gitlab-com/people-group/peopleops-eng/hris-gem'
132
+ post_install_message:
133
+ rdoc_options: []
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: 2.4.0
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubygems_version: 3.2.22
148
+ signing_key:
149
+ specification_version: 4
150
+ summary: Library to connect GitLab automations with our HRIS - independent of what
151
+ the HRIS is.
152
+ test_files: []