omniauth-outreach 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2604f3a32bf2377502b0795aa52f6340e7dbf90fdc12d484905095de50127138
4
+ data.tar.gz: 779eaab37e34e7d1913032d52b0bb47e982bc01310c624da43350b083a1a71f4
5
+ SHA512:
6
+ metadata.gz: d7706c36e94a77934a57de148bfbedfc8ff72686dc94234679566c0bd04503b9a8bd2dd4bdc69d4118c9d666d0cfeec080f32ae9fd108b627be7f2636d2d4820
7
+ data.tar.gz: 9a79cc1e5065481be9d9ecd7a183bd53e459dd4b2ce1ca834253852ae27911404d8bcafd816992ad414e9b6216a929cc3d9a01774752aaa40397750af42038d8
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] - 2024-04-17
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-outreach.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,115 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-outreach (0.1.0)
5
+ omniauth
6
+ omniauth-oauth2
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.8.6)
12
+ public_suffix (>= 2.0.2, < 6.0)
13
+ ast (2.4.2)
14
+ base64 (0.2.0)
15
+ bigdecimal (3.1.7)
16
+ coderay (1.1.3)
17
+ crack (1.0.0)
18
+ bigdecimal
19
+ rexml
20
+ diff-lcs (1.5.1)
21
+ faraday (2.8.1)
22
+ base64
23
+ faraday-net_http (>= 2.0, < 3.1)
24
+ ruby2_keywords (>= 0.0.4)
25
+ faraday-net_http (3.0.2)
26
+ hashdiff (1.1.0)
27
+ hashie (5.0.0)
28
+ json (2.7.2)
29
+ jwt (2.8.1)
30
+ base64
31
+ method_source (1.1.0)
32
+ multi_xml (0.6.0)
33
+ oauth2 (2.0.9)
34
+ faraday (>= 0.17.3, < 3.0)
35
+ jwt (>= 1.0, < 3.0)
36
+ multi_xml (~> 0.5)
37
+ rack (>= 1.2, < 4)
38
+ snaky_hash (~> 2.0)
39
+ version_gem (~> 1.1)
40
+ omniauth (2.1.2)
41
+ hashie (>= 3.4.6)
42
+ rack (>= 2.2.3)
43
+ rack-protection
44
+ omniauth-oauth2 (1.8.0)
45
+ oauth2 (>= 1.4, < 3)
46
+ omniauth (~> 2.0)
47
+ parallel (1.24.0)
48
+ parser (3.3.0.5)
49
+ ast (~> 2.4.1)
50
+ racc
51
+ pry (0.14.2)
52
+ coderay (~> 1.1)
53
+ method_source (~> 1.0)
54
+ public_suffix (5.0.5)
55
+ racc (1.7.3)
56
+ rack (2.2.9)
57
+ rack-protection (3.2.0)
58
+ base64 (>= 0.1.0)
59
+ rack (~> 2.2, >= 2.2.4)
60
+ rainbow (3.1.1)
61
+ rake (13.2.1)
62
+ regexp_parser (2.9.0)
63
+ rexml (3.2.6)
64
+ rspec (3.13.0)
65
+ rspec-core (~> 3.13.0)
66
+ rspec-expectations (~> 3.13.0)
67
+ rspec-mocks (~> 3.13.0)
68
+ rspec-core (3.13.0)
69
+ rspec-support (~> 3.13.0)
70
+ rspec-expectations (3.13.0)
71
+ diff-lcs (>= 1.2.0, < 2.0)
72
+ rspec-support (~> 3.13.0)
73
+ rspec-mocks (3.13.0)
74
+ diff-lcs (>= 1.2.0, < 2.0)
75
+ rspec-support (~> 3.13.0)
76
+ rspec-support (3.13.1)
77
+ rubocop (1.50.2)
78
+ json (~> 2.3)
79
+ parallel (~> 1.10)
80
+ parser (>= 3.2.0.0)
81
+ rainbow (>= 2.2.2, < 4.0)
82
+ regexp_parser (>= 1.8, < 3.0)
83
+ rexml (>= 3.2.5, < 4.0)
84
+ rubocop-ast (>= 1.28.0, < 2.0)
85
+ ruby-progressbar (~> 1.7)
86
+ unicode-display_width (>= 2.4.0, < 3.0)
87
+ rubocop-ast (1.30.0)
88
+ parser (>= 3.2.1.0)
89
+ ruby-progressbar (1.13.0)
90
+ ruby2_keywords (0.0.5)
91
+ snaky_hash (2.0.1)
92
+ hashie
93
+ version_gem (~> 1.1, >= 1.1.1)
94
+ unicode-display_width (2.5.0)
95
+ vcr (6.1.0)
96
+ version_gem (1.1.4)
97
+ webmock (3.23.0)
98
+ addressable (>= 2.8.0)
99
+ crack (>= 0.3.2)
100
+ hashdiff (>= 0.4.0, < 2.0.0)
101
+
102
+ PLATFORMS
103
+ x86_64-darwin-21
104
+
105
+ DEPENDENCIES
106
+ omniauth-outreach!
107
+ pry
108
+ rake (~> 13.0)
109
+ rspec (~> 3.0)
110
+ rubocop (~> 1.21)
111
+ vcr
112
+ webmock
113
+
114
+ BUNDLED WITH
115
+ 2.3.9
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Tiaki YEN
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,28 @@
1
+ # Omniauth::Outreach
2
+
3
+ ## Installation
4
+
5
+ Install the gem and add to the application's Gemfile by executing:
6
+
7
+ $ bundle add omniauth-outreach
8
+
9
+ If bundler is not being used to manage dependencies, install the gem by executing:
10
+
11
+ $ gem install omniauth-outreach
12
+
13
+ ## Usage
14
+
15
+ ```
16
+ config.omniauth :outreach, client_id: CLIENT_ID, client_secret: CLIENT_SECRET,
17
+ scope: YOUR_SCOPE,
18
+ strategy_class: ::OmniAuth::Strategies::Outreach,
19
+ redirect_uri: YOUR_CALLBACK_URI
20
+ ```
21
+
22
+ ## Contributing
23
+
24
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ekohe/omniauth-outreach.
25
+
26
+ ## License
27
+
28
+ 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]
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAuth
4
+ module Outreach
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth/outreach/version'
4
+ require 'omniauth/strategies/outreach'
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+ require 'omniauth-oauth2'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ # The OAuth2 strategy for Outreach.
7
+ class Outreach < OmniAuth::Strategies::OAuth2
8
+ option :name, 'outreach'
9
+
10
+ option :client_options, {
11
+ site: 'https://api.outreach.io',
12
+ authorize_url: 'https://api.outreach.io/oauth/authorize',
13
+ token_url: 'https://api.outreach.io/oauth/token'
14
+ }
15
+
16
+ uid { raw_info['org_user_id'] }
17
+
18
+ info do
19
+ # In our case, Outreach is returning the email address as the sub.
20
+ # But we still need to check if it's an email address or not.
21
+ raw_info['sub'].match?(/.*@.*\..*/) ? { email: raw_info['sub']} : { name: raw_info['sub'] }
22
+ end
23
+
24
+ def raw_info
25
+ @raw_info ||= JWT.decode(access_token.token, nil, false)[0]
26
+ end
27
+ end
28
+ end
29
+ end
metadata ADDED
@@ -0,0 +1,138 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-outreach
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tiaki YEN
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-04-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: vcr
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: webmock
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
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'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: omniauth
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: omniauth-oauth2
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: OmniAuth Oauth2 strategy for outreach.io - https://developers.outreach.io/api/oauth/
98
+ email:
99
+ - tiaki@ekohe.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".rspec"
105
+ - ".rubocop.yml"
106
+ - CHANGELOG.md
107
+ - Gemfile
108
+ - Gemfile.lock
109
+ - LICENSE.txt
110
+ - README.md
111
+ - Rakefile
112
+ - lib/omniauth/outreach.rb
113
+ - lib/omniauth/outreach/version.rb
114
+ - lib/omniauth/strategies/outreach.rb
115
+ homepage: https://github.com/ekohe/omniauth-outreach
116
+ licenses:
117
+ - MIT
118
+ metadata: {}
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: 2.6.0
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubygems_version: 3.0.9
135
+ signing_key:
136
+ specification_version: 4
137
+ summary: OmniAuth Oauth2 strategy for outreach.io.
138
+ test_files: []