omniauth-launch-pass 0.0.2 → 0.0.3
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 +5 -5
- data/.tool-versions +1 -0
- data/lib/omniauth/launch_pass/version.rb +1 -1
- data/lib/omniauth/strategies/launch_pass.rb +12 -0
- data/lib/omniauth-launch-pass.rb +0 -2
- data/omniauth-launch-pass.gemspec +1 -1
- metadata +7 -12
- data/lib/launch_pass/user.rb +0 -53
- data/spec/launch_pass/user_spec.rb +0 -81
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 210c6b38a42e0ccf89de646e4bdeb2f29293379b44673f7a239f60a58bd24599
|
4
|
+
data.tar.gz: 060753ba4a219464ebad9d1a843f8e59fc9194628942134b1aa2871b3dbcb28b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a7acb15facaaf7add97f805d2acc641b5a392dc1690ba6531ec1e4668aebede1ed3a7728e45e4e70c44746062d6c86aca6fbac51bb5507c631da2b46312901c
|
7
|
+
data.tar.gz: e3135d1ac5257c7478338c827d3000122266fcb177fbf5b1729a8d688b237370d93b382bb1d5d69020f9f261231edde6d1131d62e28a7f736690e22e12b88307
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 2.6.8
|
@@ -10,12 +10,24 @@ module OmniAuth
|
|
10
10
|
authorize_url: "/oauth/authorize"
|
11
11
|
}
|
12
12
|
|
13
|
+
option :authorize_params, {
|
14
|
+
signing_up: nil
|
15
|
+
}
|
16
|
+
|
13
17
|
uid { raw_info["user"]["id"].to_s }
|
14
18
|
|
15
19
|
info do
|
16
20
|
raw_info["user"]
|
17
21
|
end
|
18
22
|
|
23
|
+
def callback_url
|
24
|
+
full_host + script_name + callback_path
|
25
|
+
end
|
26
|
+
|
27
|
+
def setup_phase
|
28
|
+
request.env['omniauth.strategy'].options[:authorize_params][:signing_up] = request.params["signing_up"]
|
29
|
+
end
|
30
|
+
|
19
31
|
def raw_info
|
20
32
|
@raw_info ||= access_token.get('/api/v1/me.json').parsed
|
21
33
|
end
|
data/lib/omniauth-launch-pass.rb
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
24
|
spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.2'
|
25
|
-
spec.add_development_dependency "bundler", "~>
|
25
|
+
spec.add_development_dependency "bundler", "~> 2.3"
|
26
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
27
27
|
spec.add_development_dependency "rspec"
|
28
28
|
spec.add_development_dependency "mocha"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-launch-pass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam McTaggart
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-06-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth-oauth2
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '2.3'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
41
|
+
version: '2.3'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rake
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -105,16 +105,15 @@ extra_rdoc_files: []
|
|
105
105
|
files:
|
106
106
|
- ".gitignore"
|
107
107
|
- ".rspec"
|
108
|
+
- ".tool-versions"
|
108
109
|
- Gemfile
|
109
110
|
- LICENSE.txt
|
110
111
|
- README.md
|
111
112
|
- Rakefile
|
112
|
-
- lib/launch_pass/user.rb
|
113
113
|
- lib/omniauth-launch-pass.rb
|
114
114
|
- lib/omniauth/launch_pass/version.rb
|
115
115
|
- lib/omniauth/strategies/launch_pass.rb
|
116
116
|
- omniauth-launch-pass.gemspec
|
117
|
-
- spec/launch_pass/user_spec.rb
|
118
117
|
- spec/omniauth/strategies/launch_pass_spec.rb
|
119
118
|
- spec/spec_helper.rb
|
120
119
|
homepage: https://launchacademy.com
|
@@ -136,12 +135,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
135
|
- !ruby/object:Gem::Version
|
137
136
|
version: '0'
|
138
137
|
requirements: []
|
139
|
-
|
140
|
-
rubygems_version: 2.4.5
|
138
|
+
rubygems_version: 3.0.3.1
|
141
139
|
signing_key:
|
142
140
|
specification_version: 4
|
143
141
|
summary: Omniauth strategy for Launch Pass
|
144
|
-
test_files:
|
145
|
-
- spec/launch_pass/user_spec.rb
|
146
|
-
- spec/omniauth/strategies/launch_pass_spec.rb
|
147
|
-
- spec/spec_helper.rb
|
142
|
+
test_files: []
|
data/lib/launch_pass/user.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
module LaunchPass
|
2
|
-
class User
|
3
|
-
attr_reader :email
|
4
|
-
attr_reader :first_name
|
5
|
-
attr_reader :last_name
|
6
|
-
attr_reader :avatar_url
|
7
|
-
attr_reader :username
|
8
|
-
|
9
|
-
def initialize(info_hash)
|
10
|
-
@info_hash = info_hash
|
11
|
-
@email = @info_hash["email"]
|
12
|
-
@first_name = @info_hash["first_name"]
|
13
|
-
@last_name = @info_hash["last_name"]
|
14
|
-
@avatar_url = @info_hash["avatar_url"]
|
15
|
-
@username = @info_hash["username"]
|
16
|
-
end
|
17
|
-
|
18
|
-
def member_of?(team_name)
|
19
|
-
teams.include?(team_name)
|
20
|
-
end
|
21
|
-
|
22
|
-
def has_product?(product_name, wildcard = true)
|
23
|
-
if !wildcard
|
24
|
-
products.include?(product_name)
|
25
|
-
else
|
26
|
-
products.each do |product|
|
27
|
-
return true if product =~ /#{Regexp.escape(product_name)}/
|
28
|
-
end
|
29
|
-
false
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def admin?
|
34
|
-
member_of?('Admins')
|
35
|
-
end
|
36
|
-
|
37
|
-
def teams
|
38
|
-
if @info_hash["teams"]
|
39
|
-
@teams ||= @info_hash["teams"].map do |team_hash|
|
40
|
-
team_hash["name"]
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def products
|
46
|
-
if @info_hash["products"]
|
47
|
-
@products ||= @info_hash["products"].map do |product|
|
48
|
-
product["name"]
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe LaunchPass::User do
|
4
|
-
let(:info_hash) do
|
5
|
-
{
|
6
|
-
"id"=>1,
|
7
|
-
"first_name"=>"Dan",
|
8
|
-
"last_name"=>"Pickett",
|
9
|
-
"avatar_url"=>"https://secure.gravatar.com/avatar/c6aa1dc04e88732bcbea6c274f917c04.png?r=PG",
|
10
|
-
"username"=>"dpickett",
|
11
|
-
"email"=>"dan.pickett@launchacademy.com",
|
12
|
-
"product_offerings"=>[
|
13
|
-
{
|
14
|
-
"name"=>"Introduction to Programming Alpha",
|
15
|
-
"product"=> {"name"=>"Introduction to Programming"}
|
16
|
-
}
|
17
|
-
],
|
18
|
-
"products"=>[{"name"=>"Introduction to Programming"}],
|
19
|
-
"teams"=>[
|
20
|
-
{"id"=>1, "name"=>"Admins"},
|
21
|
-
{"id"=>2, "name"=>"Online Alpha Participants"}
|
22
|
-
]
|
23
|
-
}
|
24
|
-
end
|
25
|
-
|
26
|
-
let(:user) do
|
27
|
-
LaunchPass::User.new(info_hash)
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'indicates true if I am a member of a given team' do
|
31
|
-
expect(user).to be_member_of('Admins')
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'indicates false if I am not a member of a given team' do
|
35
|
-
expect(user).to_not be_member_of('The Fun People')
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'informs whether a user has access to a given product' do
|
39
|
-
expect(user).to have_product('Introduction to Programming')
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'informs whether a user does not have access to a given product' do
|
43
|
-
expect(user).to_not have_product('On Premises')
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'allows for a wildcard search against product names' do
|
47
|
-
expect(user).to have_product('Introduction')
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'can require an explicit match' do
|
51
|
-
expect(user).to_not have_product('Introduction', false)
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'has a list of team naems' do
|
55
|
-
expect(user.teams).to eq(['Admins', 'Online Alpha Participants'])
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'has a list of products' do
|
59
|
-
expect(user.products).to eq(['Introduction to Programming'])
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'has an email' do
|
63
|
-
expect(user.email).to_not be_nil
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'has a first name' do
|
67
|
-
expect(user.first_name).to_not be_nil
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'has a last name' do
|
71
|
-
expect(user.last_name).to_not be_nil
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'has an avatar url' do
|
75
|
-
expect(user.avatar_url).to_not be_nil
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'has a username' do
|
79
|
-
expect(user.username).to_not be_nil
|
80
|
-
end
|
81
|
-
end
|