peoplegroup-connectors 0.1.2 → 0.1.8

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: 0cd3e2299c0749eacfa79fa3d8f9d4ac9a7cb59b817ed9d85e89ff42d919e7ff
4
- data.tar.gz: b5daffe094fd83d2ccb41c97598feef9ab7e31f78b6254ab1e0bf0fb84d4f6d3
3
+ metadata.gz: 970e02a20813047a8a3673fc205db913c74a05f796c638527d646a47a45b6b3c
4
+ data.tar.gz: bface6e5766fd959d452b59a50b329e0382a551657652048a170219193903106
5
5
  SHA512:
6
- metadata.gz: fec64050cb1516d8bc1426240d779b1544c3a32a1d8cb6daba836adeccfc1daed3ebc49210962d2da850b7b0d48fc790fa81bc0feebf9b4ab5a8482a1bf19e64
7
- data.tar.gz: 9ec82b1b16a7e2d34fac56ab5b860bfd19fbd72ea9a32ef8503b937a1f19c261b930bcdc7ff8fff4535662f7ebcd23d9f934345627151d5736f074a805c4f7b3
6
+ metadata.gz: 953986438996dd78ee42d3a8b38530d17552225f7f32bc13155aa9fec254243fe7202fa3f5ad40559988f8b1812e5a85f9fa99585dbdb147c9713043db9d6d3f
7
+ data.tar.gz: 40e562e07ac901a4557680933f6ac0bce5eebe9f8ab9f0d40289a46e96a875fd0b27355bc5a386a3988ae838bbf9c06dcd767a78cbb704f0dc9e2697f520a509
@@ -2,6 +2,8 @@
2
2
 
3
3
  require_relative 'connectors/version'
4
4
  require_relative 'connectors/gitlab'
5
+ require_relative 'connectors/slack'
6
+ require_relative 'connectors/pto_roots'
5
7
 
6
8
  module PeopleGroup
7
9
  module Connectors
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'splinter'
4
+
5
+ module PeopleGroup
6
+ module Connectors
7
+ class PTORoots
8
+ def initialize
9
+ ::Splinter.configure do |config|
10
+ config.api_key = ENV['PTO_ROOTS_API_KEY']
11
+ end
12
+ end
13
+
14
+ def pto(params)
15
+ Splinter::OOOEvents.get_all(params)
16
+ end
17
+
18
+ def pto_type(type)
19
+ pto_types.find { |pto_type| pto_type['name'] == type }
20
+ end
21
+
22
+ private
23
+
24
+ def pto_types
25
+ Splinter::OOOTypes.get_all
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'slack-ruby-client'
4
+
5
+ module PeopleGroup
6
+ module Connectors
7
+ class Slack
8
+ def initialize
9
+ ::Slack.configure do |config|
10
+ config.token = ENV['SLACK_API_TOKEN']
11
+ end
12
+ @client = ::Slack::Web::Client.new
13
+ end
14
+
15
+ def send_message(channel, message)
16
+ @client.chat_postMessage(channel: channel, text: message, as_user: true)
17
+ end
18
+
19
+ def find_user(email)
20
+ @client.users_lookupByEmail(email: email)
21
+ rescue ::Slack::Web::Api::Errors::SlackError
22
+ nil
23
+ end
24
+
25
+ def list_public_channels
26
+ channels = @client.channels_list(exclude_archived: true).channels
27
+ channels.reject(&:is_private)&.map(:name)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module PeopleGroup
4
4
  module Connectors
5
- VERSION = '0.1.2'
5
+ VERSION = '0.1.8'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peoplegroup-connectors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - lien van den steen
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-01 00:00:00.000000000 Z
11
+ date: 2021-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: slack-ruby-client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.14'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.14'
41
+ - !ruby/object:Gem::Dependency
42
+ name: splinter-pto
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.1'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: rspec
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -87,23 +115,13 @@ executables: []
87
115
  extensions: []
88
116
  extra_rdoc_files: []
89
117
  files:
90
- - ".gitignore"
91
- - ".gitlab-ci.yml"
92
- - ".rspec"
93
- - ".rubocop.yml"
94
- - ".rubocop_todo.yml"
95
- - CODE_OF_CONDUCT.md
96
- - Gemfile
97
- - Gemfile.lock
98
118
  - LICENSE.txt
99
119
  - README.md
100
- - Rakefile
101
- - bin/console
102
- - bin/setup
103
120
  - lib/peoplegroup/connectors.rb
104
121
  - lib/peoplegroup/connectors/gitlab.rb
122
+ - lib/peoplegroup/connectors/pto_roots.rb
123
+ - lib/peoplegroup/connectors/slack.rb
105
124
  - lib/peoplegroup/connectors/version.rb
106
- - peoplegroup-connectors.gemspec
107
125
  homepage: https://gitlab.com/gitlab-com/people-group/peopleops-eng/connectors-gem
108
126
  licenses:
109
127
  - MIT
data/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
data/.gitlab-ci.yml DELETED
@@ -1,20 +0,0 @@
1
- rspec:
2
- stage: test
3
- only:
4
- - merge_requests
5
- script:
6
- - gem install bundler
7
- - bundle install
8
- - bundle exec rspec
9
-
10
- rubocop:
11
- stage: test
12
- only:
13
- - merge_requests
14
- script:
15
- - gem install bundler
16
- - bundle install
17
- - bundle exec rubocop
18
-
19
- include:
20
- template: Dependency-Scanning.gitlab-ci.yml
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,21 +0,0 @@
1
- inherit_from: .rubocop_todo.yml
2
-
3
- require:
4
- - rubocop-rspec
5
- - rubocop-packaging
6
-
7
- AllCops:
8
- TargetRubyVersion: 2.7
9
- # Cop names are displayed in offense messages by default. Change behavior
10
- # by overriding DisplayCopNames, or by giving the `--no-display-cop-names`
11
- # option.
12
- DisplayCopNames: true
13
- # Style guide URLs are not displayed in offense messages by default. Change
14
- # behavior by overriding DisplayStyleGuide, or by giving the
15
- # -S/--display-style-guide option.
16
- DisplayStyleGuide: false
17
- # Exclude some GitLab files
18
- NewCops: enable
19
-
20
- Style/Documentation:
21
- Enabled: false
data/.rubocop_todo.yml DELETED
@@ -1,72 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2021-01-29 12:09:47 UTC using RuboCop version 0.93.1.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 1
10
- # Configuration parameters: Include.
11
- # Include: **/*.gemspec
12
- Gemspec/RequiredRubyVersion:
13
- Exclude:
14
- - 'peoplegroup-connectors.gemspec'
15
-
16
- # Offense count: 1
17
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
18
- # ExcludedMethods: refine
19
- Metrics/BlockLength:
20
- Max: 104
21
-
22
- # Offense count: 2
23
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
24
- Metrics/MethodLength:
25
- Max: 22
26
-
27
- # Offense count: 2
28
- # Configuration parameters: CountKeywordArgs.
29
- Metrics/ParameterLists:
30
- Max: 6
31
-
32
- # Offense count: 1
33
- Packaging/GemspecGit:
34
- Exclude:
35
- - 'peoplegroup-connectors.gemspec'
36
-
37
- # Offense count: 1
38
- # Configuration parameters: Max.
39
- RSpec/ExampleLength:
40
- Exclude:
41
- - 'spec/peoplegroup/connectors/gitlab_spec.rb'
42
-
43
- # Offense count: 2
44
- # Configuration parameters: CustomTransform, IgnoreMethods, SpecSuffixOnly.
45
- RSpec/FilePath:
46
- Exclude:
47
- - 'spec/peoplegroup/connectors/gitlab_spec.rb'
48
- - 'spec/peoplegroup/connectors_spec.rb'
49
-
50
- # Offense count: 3
51
- RSpec/MultipleExpectations:
52
- Max: 3
53
-
54
- # Offense count: 5
55
- # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
56
- RSpec/VerifiedDoubles:
57
- Exclude:
58
- - 'spec/peoplegroup/connectors/gitlab_spec.rb'
59
-
60
- # Offense count: 2
61
- # Cop supports --auto-correct.
62
- # Configuration parameters: AllowOnConstant.
63
- Style/CaseEquality:
64
- Exclude:
65
- - 'lib/peoplegroup/connectors/gitlab.rb'
66
-
67
- # Offense count: 6
68
- # Cop supports --auto-correct.
69
- # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
70
- # URISchemes: http, https
71
- Layout/LineLength:
72
- Max: 185
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at lvandensteen@gitlab.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [https://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: https://contributor-covenant.org
74
- [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- # Specify your gem's dependencies in gl-people-connectors.gemspec
6
- gemspec
7
-
8
- gem 'rake', '~> 12.0'
9
- gem 'rspec', '~> 3.0'
data/Gemfile.lock DELETED
@@ -1,75 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- peoplegroup-connectors (0.1.0)
5
- gitlab
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- ast (2.4.2)
11
- diff-lcs (1.4.4)
12
- gitlab (4.17.0)
13
- httparty (~> 0.18)
14
- terminal-table (~> 1.5, >= 1.5.1)
15
- httparty (0.18.1)
16
- mime-types (~> 3.0)
17
- multi_xml (>= 0.5.2)
18
- mime-types (3.3.1)
19
- mime-types-data (~> 3.2015)
20
- mime-types-data (3.2020.1104)
21
- multi_xml (0.6.0)
22
- parallel (1.20.1)
23
- parser (3.0.0.0)
24
- ast (~> 2.4.1)
25
- rainbow (3.0.0)
26
- rake (12.3.3)
27
- regexp_parser (2.0.3)
28
- rexml (3.2.4)
29
- rspec (3.10.0)
30
- rspec-core (~> 3.10.0)
31
- rspec-expectations (~> 3.10.0)
32
- rspec-mocks (~> 3.10.0)
33
- rspec-core (3.10.1)
34
- rspec-support (~> 3.10.0)
35
- rspec-expectations (3.10.1)
36
- diff-lcs (>= 1.2.0, < 2.0)
37
- rspec-support (~> 3.10.0)
38
- rspec-mocks (3.10.2)
39
- diff-lcs (>= 1.2.0, < 2.0)
40
- rspec-support (~> 3.10.0)
41
- rspec-support (3.10.2)
42
- rubocop (0.93.1)
43
- parallel (~> 1.10)
44
- parser (>= 2.7.1.5)
45
- rainbow (>= 2.2.2, < 4.0)
46
- regexp_parser (>= 1.8)
47
- rexml
48
- rubocop-ast (>= 0.6.0)
49
- ruby-progressbar (~> 1.7)
50
- unicode-display_width (>= 1.4.0, < 2.0)
51
- rubocop-ast (1.4.1)
52
- parser (>= 2.7.1.5)
53
- rubocop-packaging (0.5.1)
54
- rubocop (>= 0.89, < 2.0)
55
- rubocop-rspec (1.44.1)
56
- rubocop (~> 0.87)
57
- rubocop-ast (>= 0.7.1)
58
- ruby-progressbar (1.11.0)
59
- terminal-table (1.8.0)
60
- unicode-display_width (~> 1.1, >= 1.1.1)
61
- unicode-display_width (1.7.0)
62
-
63
- PLATFORMS
64
- ruby
65
-
66
- DEPENDENCIES
67
- peoplegroup-connectors!
68
- rake (~> 12.0)
69
- rspec (~> 3.0)
70
- rubocop (~> 0.85)
71
- rubocop-packaging (~> 0.1)
72
- rubocop-rspec (~> 1.39)
73
-
74
- BUNDLED WITH
75
- 2.1.4
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- task default: :spec
data/bin/console DELETED
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'bundler/setup'
5
- require 'peoplegroup/connectors'
6
-
7
- def reload!(print: true)
8
- puts 'Reloading ...' if print
9
- # Main project directory.
10
- root_dir = File.expand_path('..', __dir__)
11
- # Directories within the project that should be reloaded.
12
- reload_dirs = %w[lib]
13
- # Loop through and reload every file in all relevant project directories.
14
- reload_dirs.each do |dir|
15
- Dir.glob("#{root_dir}/#{dir}/**/*.rb").each { |f| load(f) }
16
- end
17
- # Return true when complete.
18
- true
19
- end
20
-
21
- # (If you use this, don't forget to add pry to your Gemfile!)
22
- # require "pry"
23
- # Pry.start
24
-
25
- require 'irb'
26
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'lib/peoplegroup/connectors/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'peoplegroup-connectors'
7
- spec.version = PeopleGroup::Connectors::VERSION
8
- spec.authors = ['lien van den steen']
9
- spec.email = ['lvandensteen@gitlab.com']
10
-
11
- spec.summary = 'Library for our shared connectors.'
12
- spec.description = 'Avoid repeating methods in different projects for our connectos.'
13
- spec.homepage = 'https://gitlab.com/gitlab-com/people-group/peopleops-eng/connectors-gem'
14
- spec.license = 'MIT'
15
- spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
16
-
17
- spec.metadata['homepage_uri'] = spec.homepage
18
- spec.metadata['source_code_uri'] = spec.homepage
19
- spec.metadata['changelog_uri'] = spec.homepage
20
-
21
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
- end
24
- spec.bindir = 'exe'
25
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
- spec.require_paths = ['lib']
27
-
28
-
29
- spec.add_dependency 'gitlab'
30
-
31
- spec.add_development_dependency 'rspec', '~> 3.2'
32
- spec.add_development_dependency 'rubocop', '~> 0.85'
33
- spec.add_development_dependency 'rubocop-packaging', '~> 0.1'
34
- spec.add_development_dependency 'rubocop-rspec', '~> 1.39'
35
- end