omniauth-monday 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: e808eed732139e31430e01d1cef847e02f105cf96589fb44941827f0cb2c8105
4
+ data.tar.gz: c9a3744ae8aecea09ec38148580a421946245e90b491c1e7fc4d62894674b7ad
5
+ SHA512:
6
+ metadata.gz: fbfe677a681d11ccdb3e197ca62cc48b342d276847f4f1427b2a838c406c61af67c244172de66e0129fd33da7a41fbb32dede32a1f6b3b8eac0d0e39afcfa68e
7
+ data.tar.gz: 197589de12c47e9f45594b8542974114ab93df67a2052fc60d1d2cb0bd428614f2f7221e7058a62f01f723923d186d5e04aa5a56130a9fe07fe720d0311713b1
data/.gitignore ADDED
@@ -0,0 +1,11 @@
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/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2023-08-30
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in omniauth-monday.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.21"
data/Gemfile.lock ADDED
@@ -0,0 +1,110 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-monday (0.1.0)
5
+ graphql-client
6
+ omniauth (~> 2.0)
7
+ omniauth-oauth2 (~> 1.7)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activesupport (7.0.7.2)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (>= 1.6, < 2)
15
+ minitest (>= 5.1)
16
+ tzinfo (~> 2.0)
17
+ ast (2.4.2)
18
+ base64 (0.1.1)
19
+ concurrent-ruby (1.2.2)
20
+ diff-lcs (1.5.0)
21
+ faraday (2.7.10)
22
+ faraday-net_http (>= 2.0, < 3.1)
23
+ ruby2_keywords (>= 0.0.4)
24
+ faraday-net_http (3.0.2)
25
+ graphql (2.1.0)
26
+ graphql-client (0.18.0)
27
+ activesupport (>= 3.0)
28
+ graphql
29
+ hashie (5.0.0)
30
+ i18n (1.14.1)
31
+ concurrent-ruby (~> 1.0)
32
+ json (2.6.3)
33
+ jwt (2.7.1)
34
+ language_server-protocol (3.17.0.3)
35
+ minitest (5.19.0)
36
+ multi_xml (0.6.0)
37
+ oauth2 (2.0.9)
38
+ faraday (>= 0.17.3, < 3.0)
39
+ jwt (>= 1.0, < 3.0)
40
+ multi_xml (~> 0.5)
41
+ rack (>= 1.2, < 4)
42
+ snaky_hash (~> 2.0)
43
+ version_gem (~> 1.1)
44
+ omniauth (2.1.1)
45
+ hashie (>= 3.4.6)
46
+ rack (>= 2.2.3)
47
+ rack-protection
48
+ omniauth-oauth2 (1.8.0)
49
+ oauth2 (>= 1.4, < 3)
50
+ omniauth (~> 2.0)
51
+ parallel (1.23.0)
52
+ parser (3.2.2.3)
53
+ ast (~> 2.4.1)
54
+ racc
55
+ racc (1.7.1)
56
+ rack (3.0.8)
57
+ rack-protection (3.0.6)
58
+ rack
59
+ rainbow (3.1.1)
60
+ rake (13.0.6)
61
+ regexp_parser (2.8.1)
62
+ rexml (3.2.6)
63
+ rspec (3.12.0)
64
+ rspec-core (~> 3.12.0)
65
+ rspec-expectations (~> 3.12.0)
66
+ rspec-mocks (~> 3.12.0)
67
+ rspec-core (3.12.2)
68
+ rspec-support (~> 3.12.0)
69
+ rspec-expectations (3.12.3)
70
+ diff-lcs (>= 1.2.0, < 2.0)
71
+ rspec-support (~> 3.12.0)
72
+ rspec-mocks (3.12.6)
73
+ diff-lcs (>= 1.2.0, < 2.0)
74
+ rspec-support (~> 3.12.0)
75
+ rspec-support (3.12.1)
76
+ rubocop (1.56.2)
77
+ base64 (~> 0.1.1)
78
+ json (~> 2.3)
79
+ language_server-protocol (>= 3.17.0)
80
+ parallel (~> 1.10)
81
+ parser (>= 3.2.2.3)
82
+ rainbow (>= 2.2.2, < 4.0)
83
+ regexp_parser (>= 1.8, < 3.0)
84
+ rexml (>= 3.2.5, < 4.0)
85
+ rubocop-ast (>= 1.28.1, < 2.0)
86
+ ruby-progressbar (~> 1.7)
87
+ unicode-display_width (>= 2.4.0, < 3.0)
88
+ rubocop-ast (1.29.0)
89
+ parser (>= 3.2.1.0)
90
+ ruby-progressbar (1.13.0)
91
+ ruby2_keywords (0.0.5)
92
+ snaky_hash (2.0.1)
93
+ hashie
94
+ version_gem (~> 1.1, >= 1.1.1)
95
+ tzinfo (2.0.6)
96
+ concurrent-ruby (~> 1.0)
97
+ unicode-display_width (2.4.2)
98
+ version_gem (1.1.3)
99
+
100
+ PLATFORMS
101
+ x86_64-darwin-21
102
+
103
+ DEPENDENCIES
104
+ omniauth-monday!
105
+ rake (~> 13.0)
106
+ rspec (~> 3.0)
107
+ rubocop (~> 1.21)
108
+
109
+ BUNDLED WITH
110
+ 2.3.8
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Rob Race
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,39 @@
1
+ # Omniauth::Monday
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/omniauth/monday`. 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 'omniauth-monday'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install omniauth-monday
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]/omniauth-monday.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
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
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "omniauth/monday"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
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
@@ -0,0 +1,65 @@
1
+ require "omniauth-oauth2"
2
+ require "graphql/client"
3
+ require "graphql/client/http"
4
+
5
+ module OmniAuth
6
+ module Strategies
7
+ class Monday < OmniAuth::Strategies::OAuth2
8
+ option :client_options, {
9
+ site: "https://api.monday.com/v2",
10
+ authorize_url: "https://auth.monday.com/oauth2/authorize",
11
+ token_url: "https://auth.monday.com/oauth2/token",
12
+ }
13
+
14
+ def request_phase
15
+ super
16
+ end
17
+
18
+ def authorize_params
19
+ super.tap do |params|
20
+ %w[client_options].each do |v|
21
+ if request.params[v]
22
+ params[v.to_sym] = request.params[v]
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ uid { me["id"] }
29
+
30
+ extra do
31
+ { raw_info: me }
32
+ end
33
+
34
+ def raw_info
35
+ @raw_info ||= {}
36
+ end
37
+
38
+ def me
39
+ @me ||= begin
40
+ access_token.options[:mode] = :header
41
+ response = access_token.post("", body: { query: query }).parsed
42
+ response["data"]["me"].merge("account_id": response["account_id"])
43
+ end
44
+ end
45
+
46
+ def callback_url
47
+ full_host + script_name + callback_path
48
+ end
49
+
50
+ def query
51
+ <<~GRAPHQL
52
+ query {
53
+ me {
54
+ email
55
+ name
56
+ id
57
+ }
58
+ }
59
+ GRAPHQL
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ OmniAuth.config.add_camelization "monday", "Monday"
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Omniauth
4
+ module Monday
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,2 @@
1
+ require "omniauth-monday/version"
2
+ require "omniauth/strategies/monday"
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path('../lib/omniauth-monday/version', __FILE__)
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "omniauth-monday"
7
+ gem.version = Omniauth::Monday::VERSION
8
+ gem.authors = ["Rob Race"]
9
+ gem.email = ["rob@succinctsoftwarellc.com"]
10
+
11
+ gem.summary = %q{Official OmniAuth strategy for Monday.com.}
12
+ gem.description = %q{Official OmniAuth strategy for Monday.com.}
13
+ gem.homepage = "https://github.com/rob-race/omniauth-monday"
14
+ gem.license = "MIT"
15
+ gem.required_ruby_version = ">= 2.6.0"
16
+
17
+ gem.metadata["homepage_uri"] = gem.homepage
18
+
19
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ gem.files = `git ls-files`.split("\n")
21
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
22
+ gem.name = "omniauth-monday"
23
+ gem.require_paths = ["lib"]
24
+
25
+ gem.add_dependency 'omniauth', '~> 2.0'
26
+ gem.add_dependency 'omniauth-oauth2', '~> 1.7'
27
+ gem.add_dependency 'graphql-client'
28
+ end
@@ -0,0 +1,6 @@
1
+ module Omniauth
2
+ module Monday
3
+ VERSION: String
4
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
5
+ end
6
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Omniauth::Monday do
4
+ it "has a version number" do
5
+ expect(Omniauth::Monday::VERSION).not_to be nil
6
+ end
7
+
8
+ it "does something useful" do
9
+ expect(false).to eq(true)
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "omniauth/monday"
4
+
5
+ RSpec.configure do |config|
6
+ # Enable flags like --only-failures and --next-failure
7
+ config.example_status_persistence_file_path = ".rspec_status"
8
+
9
+ # Disable RSpec exposing methods globally on `Module` and `main`
10
+ config.disable_monkey_patching!
11
+
12
+ config.expect_with :rspec do |c|
13
+ c.syntax = :expect
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-monday
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Rob Race
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-08-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: omniauth-oauth2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: graphql-client
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Official OmniAuth strategy for Monday.com.
56
+ email:
57
+ - rob@succinctsoftwarellc.com
58
+ executables:
59
+ - console
60
+ - setup
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".gitignore"
65
+ - ".rspec"
66
+ - ".rubocop.yml"
67
+ - CHANGELOG.md
68
+ - Gemfile
69
+ - Gemfile.lock
70
+ - LICENSE.txt
71
+ - README.md
72
+ - Rakefile
73
+ - bin/console
74
+ - bin/setup
75
+ - lib/omniauth-monday.rb
76
+ - lib/omniauth-monday/version.rb
77
+ - lib/omniauth/strategies/monday.rb
78
+ - omniauth-monday.gemspec
79
+ - sig/omniauth/monday.rbs
80
+ - spec/omniauth/monday_spec.rb
81
+ - spec/spec_helper.rb
82
+ homepage: https://github.com/rob-race/omniauth-monday
83
+ licenses:
84
+ - MIT
85
+ metadata:
86
+ homepage_uri: https://github.com/rob-race/omniauth-monday
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 2.6.0
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubygems_version: 3.3.7
103
+ signing_key:
104
+ specification_version: 4
105
+ summary: Official OmniAuth strategy for Monday.com.
106
+ test_files:
107
+ - spec/omniauth/monday_spec.rb
108
+ - spec/spec_helper.rb