omniauth-mlh 0.4.1 → 1.0.0

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: 1608c1c551536f2dde7aa485c7b6f61ed4ffa9131805d930f12e65aeb09b25ee
4
- data.tar.gz: fcaf372603aede88fc7623f6aa981aefea2467597907a5266ab4f3ba57f4345b
3
+ metadata.gz: 622c9053382357ade0f161e78ed3f13ae01ae9f939b9bae87b43ff3281b618e2
4
+ data.tar.gz: bc057ee83655fcac77978e15a21891013981853cebc8e7c235d08601468d8156
5
5
  SHA512:
6
- metadata.gz: fffcc909ecd51283296ed328d36c5770a6fd0e1d11e8f51f40d9abb67ba0db4ce2b5638d0e83afdbeec01d39ed1393a9dcac311bc6c99d7ae291d7066313f50d
7
- data.tar.gz: 8ca616032f69b5e082b02a880a75562d1620594d8fb34c611a05041d2e7217095240a6595aa5cf503b7ed2cf1a06a931ab988c7c91e405b5e64dd29add0eda63
6
+ metadata.gz: b4cd23553337c4dc6537a4c432c61d00f84334cd0d0372d7c3148b0c85bf175834a97ac9e213623e17541349f16b15e4489bfe0f8658302ae7fc01d71e4ad76f
7
+ data.tar.gz: fb197ac156fb8a6ff76c8ce5b7e01ba016ff3859ad3741cd10da11932c274c7dc33c0f1dffbc766e0479cc4607d29621267e942ed1d26f22df37bdbb8f432050
data/.rubocop.yml ADDED
@@ -0,0 +1,12 @@
1
+ AllCops:
2
+ TargetRubyVersion: '2.2.0'
3
+
4
+ Naming/FileName:
5
+ Exclude:
6
+ - 'lib/omniauth-mlh.rb'
7
+
8
+ Metrics/BlockLength:
9
+ Exclude:
10
+ - 'Rakefile'
11
+ - '**/*.rake'
12
+ - 'spec/**/*'
data/.travis.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.4
3
+ - 3.0.5
data/README.md CHANGED
@@ -12,7 +12,7 @@ Once you have done so, you can follow the instructions below:
12
12
 
13
13
  ## Requirements
14
14
 
15
- You need to have at least Ruby 2.2.4 to use this gem.
15
+ You need to have at least Ruby 3.0.5 to use this gem.
16
16
 
17
17
  ## Installation
18
18
 
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
2
+ require 'bundler/gem_tasks'
3
3
  require 'rspec/core/rake_task'
4
4
 
5
5
  RSpec::Core::RakeTask.new
6
6
 
7
7
  desc 'Run specs'
8
- task :default => :spec
8
+ task default: :spec
@@ -1,15 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'omniauth-oauth2'
2
4
  require 'ostruct'
3
5
 
4
6
  module OmniAuth
5
7
  module Strategies
6
- class MLH < OmniAuth::Strategies::OAuth2
8
+ class MLH < OmniAuth::Strategies::OAuth2 # :nodoc:
7
9
  option :name, :mlh
8
10
 
9
11
  option :client_options, {
10
- :site => 'https://my.mlh.io',
11
- :authorize_path => '/oauth/authorize',
12
- :token_path => '/oauth/token'
12
+ site: 'https://my.mlh.io',
13
+ authorize_url: 'oauth/authorize',
14
+ token_url: 'oauth/token'
13
15
  }
14
16
 
15
17
  uid { data[:id] }
@@ -26,16 +28,25 @@ module OmniAuth
26
28
  :date_of_birth,
27
29
  :gender,
28
30
  :phone_number,
31
+ :profession_type,
32
+ :company_name,
33
+ :company_title,
29
34
  :scopes,
30
35
  :school
31
36
  )
32
37
  end
33
38
 
34
39
  def data
35
- @data ||= access_token.get('/api/v3/user.json').parsed.deep_symbolize_keys[:data] rescue {}
40
+ @data ||= begin
41
+ access_token.get('/api/v3/user.json').parsed.deep_symbolize_keys[:data]
42
+ rescue StandardError
43
+ {}
44
+ end
36
45
  end
37
46
  end
38
47
  end
39
48
  end
40
49
 
41
50
  OmniAuth.config.add_camelization 'mlh', 'MLH'
51
+ OmniAuth.config.allowed_request_methods = %i[post get]
52
+ OmniAuth.config.silence_get_warning = true
@@ -1,9 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OmniAuth
2
4
  module MLH
3
- MAJOR_VERSION = 0
4
- MINOR_VERSION = 4
5
- RELEASE_VERSION = 1
6
-
7
- VERSION = [MAJOR_VERSION, MINOR_VERSION, RELEASE_VERSION].join('.')
5
+ VERSION = '1.0.0'
8
6
  end
9
7
  end
data/lib/omniauth-mlh.rb CHANGED
@@ -1,3 +1,5 @@
1
- require "active_support"
2
- require "omniauth-mlh/version"
3
- require "omniauth/strategies/mlh"
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support'
4
+ require 'omniauth-mlh/version'
5
+ require 'omniauth/strategies/mlh'
data/omniauth-mlh.gemspec CHANGED
@@ -1,33 +1,38 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
4
6
  require 'omniauth-mlh/version'
5
7
 
6
8
  Gem::Specification.new do |spec|
7
- spec.name = "omniauth-mlh"
9
+ spec.name = 'omniauth-mlh'
8
10
  spec.version = OmniAuth::MLH::VERSION
9
- spec.authors = ["Swift"]
10
- spec.email = ["swift@mlh.io"]
11
+ spec.authors = ['Swift']
12
+ spec.email = ['swift@mlh.io']
11
13
 
12
- spec.summary = %q{Official OmniAuth strategy for My MLH.}
13
- spec.description = %q{Official OmniAuth strategy for My MLH.}
14
- spec.homepage = "http://github.com/mlh/omniauth-mlh"
15
- spec.license = "MIT"
14
+ spec.summary = 'Official OmniAuth strategy for MyMLH.'
15
+ spec.description = 'Official OmniAuth strategy for MyMLH.'
16
+ spec.homepage = 'http://github.com/mlh/omniauth-mlh'
17
+ spec.license = 'MIT'
16
18
 
17
- spec.required_ruby_version = '>= 2.2.4'
19
+ spec.required_ruby_version = '>= 2.2.0'
18
20
 
19
- spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
20
22
  spec.files = `git ls-files`.split("\n")
21
23
  spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
22
- spec.require_paths = ["lib"]
24
+ spec.require_paths = ['lib']
25
+
26
+ spec.add_dependency 'oauth2', '~> 2.0.9'
27
+ spec.add_dependency 'omniauth', '~> 2.1.1'
28
+ spec.add_dependency 'omniauth-oauth2', '~> 1.8.0'
29
+ spec.add_dependency 'omniauth-rails_csrf_protection', '~> 1.0.1'
23
30
 
24
- spec.add_dependency 'omniauth', '~> 1.0'
25
- spec.add_dependency 'omniauth-oauth2', '~> 1.3.1'
26
31
  spec.add_dependency 'activesupport'
27
32
 
28
- spec.add_development_dependency 'rspec', '~> 2.7'
29
- spec.add_development_dependency 'rake', '~> 10.5'
30
33
  spec.add_development_dependency 'rack-test'
34
+ spec.add_development_dependency 'rake', '~> 10.5'
35
+ spec.add_development_dependency 'rspec', '~> 2.7'
31
36
  spec.add_development_dependency 'simplecov'
32
37
  spec.add_development_dependency 'webmock'
33
38
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe OmniAuth::MLH do
@@ -13,23 +15,23 @@ describe OmniAuth::MLH do
13
15
  end
14
16
 
15
17
  it 'has correct authorize url' do
16
- expect(subject.client.options[:authorize_url]).to eq('/oauth/authorize')
18
+ expect(subject.client.options[:authorize_url]).to eq('oauth/authorize')
17
19
  end
18
20
 
19
21
  it 'has correct token url' do
20
- expect(subject.client.options[:token_url]).to eq('/oauth/token')
22
+ expect(subject.client.options[:token_url]).to eq('oauth/token')
21
23
  end
22
24
 
23
25
  it 'runs the setup block if passed one' do
24
26
  counter = ''
25
- @options = { :setup => Proc.new { |env| counter = 'ok' } }
27
+ @options = { setup: proc { |_env| counter = 'ok' } }
26
28
  subject.setup_phase
27
- expect(counter).to eq("ok")
29
+ expect(counter).to eq('ok')
28
30
  end
29
31
  end
30
32
 
31
33
  describe '#callback_path' do
32
- it "has the correct callback path" do
34
+ it 'has the correct callback path' do
33
35
  expect(subject.callback_path).to eq('/auth/mlh/callback')
34
36
  end
35
37
  end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,6 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
2
4
 
3
5
  require 'simplecov'
4
6
  SimpleCov.start
@@ -9,12 +11,13 @@ require 'rack/test'
9
11
  require 'webmock/rspec'
10
12
  require 'omniauth'
11
13
  require 'omniauth-mlh'
12
- Dir[File.expand_path('../support/**/*', __FILE__)].each { |f| require f }
14
+
15
+ Dir[File.expand_path('support/**/*', __dir__)].sort.each { |f| require f }
13
16
 
14
17
  RSpec.configure do |config|
15
18
  config.include WebMock::API
16
19
  config.include Rack::Test::Methods
17
- config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
20
+ config.extend OmniAuth::Test::StrategyMacros, type: :strategy
18
21
 
19
22
  OmniAuth.config.test_mode = true
20
23
  end
@@ -1,23 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Credit: https://github.com/datariot/omniauth-paypal/blob/master/spec/support/shared_examples.rb
2
4
  # NOTE it would be useful if this lived in omniauth-oauth2 eventually
3
5
 
4
6
  shared_examples 'an oauth2 strategy' do
5
7
  describe '#client' do
6
8
  it 'should be initialized with symbolized client_options' do
7
- @options = { :client_options => { 'authorize_url' => 'https://example.com' } }
9
+ @options = { client_options: { 'authorize_url' => 'https://example.com' } }
8
10
  expect(subject.client.options[:authorize_url]).to eq('https://example.com')
9
11
  end
10
12
  end
11
13
 
12
14
  describe '#authorize_params' do
13
15
  it 'should include any authorize params passed in the :authorize_params option' do
14
- @options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } }
16
+ @options = { authorize_params: { foo: 'bar', baz: 'zip' } }
15
17
  expect(subject.authorize_params['foo']).to eq('bar')
16
18
  expect(subject.authorize_params['baz']).to eq('zip')
17
19
  end
18
20
 
19
21
  it 'should include top-level options that are marked as :authorize_options' do
20
- @options = { :authorize_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
22
+ @options = { authorize_options: %i[scope foo], scope: 'bar', foo: 'baz' }
21
23
  expect(subject.authorize_params['scope']).to eq('bar')
22
24
  expect(subject.authorize_params['foo']).to eq('baz')
23
25
  end
@@ -25,13 +27,13 @@ shared_examples 'an oauth2 strategy' do
25
27
 
26
28
  describe '#token_params' do
27
29
  it 'should include any token params passed in the :token_params option' do
28
- @options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
30
+ @options = { token_params: { foo: 'bar', baz: 'zip' } }
29
31
  expect(subject.token_params['foo']).to eq('bar')
30
32
  expect(subject.token_params['baz']).to eq('zip')
31
33
  end
32
34
 
33
35
  it 'should include top-level options that are marked as :token_options' do
34
- @options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
36
+ @options = { token_options: %i[scope foo], scope: 'bar', foo: 'baz' }
35
37
  expect(subject.token_params['scope']).to eq('bar')
36
38
  expect(subject.token_params['foo']).to eq('baz')
37
39
  end
metadata CHANGED
@@ -1,43 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-mlh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Swift
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-13 00:00:00.000000000 Z
11
+ date: 2023-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: oauth2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.9
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.9
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: omniauth
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: '1.0'
33
+ version: 2.1.1
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: '1.0'
40
+ version: 2.1.1
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: omniauth-oauth2
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: 1.3.1
47
+ version: 1.8.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.8.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: omniauth-rails_csrf_protection
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.1
34
62
  type: :runtime
35
63
  prerelease: false
36
64
  version_requirements: !ruby/object:Gem::Requirement
37
65
  requirements:
38
66
  - - "~>"
39
67
  - !ruby/object:Gem::Version
40
- version: 1.3.1
68
+ version: 1.0.1
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: activesupport
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -53,19 +81,19 @@ dependencies:
53
81
  - !ruby/object:Gem::Version
54
82
  version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
- name: rspec
84
+ name: rack-test
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
- - - "~>"
87
+ - - ">="
60
88
  - !ruby/object:Gem::Version
61
- version: '2.7'
89
+ version: '0'
62
90
  type: :development
63
91
  prerelease: false
64
92
  version_requirements: !ruby/object:Gem::Requirement
65
93
  requirements:
66
- - - "~>"
94
+ - - ">="
67
95
  - !ruby/object:Gem::Version
68
- version: '2.7'
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: rake
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -81,19 +109,19 @@ dependencies:
81
109
  - !ruby/object:Gem::Version
82
110
  version: '10.5'
83
111
  - !ruby/object:Gem::Dependency
84
- name: rack-test
112
+ name: rspec
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
- - - ">="
115
+ - - "~>"
88
116
  - !ruby/object:Gem::Version
89
- version: '0'
117
+ version: '2.7'
90
118
  type: :development
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
- - - ">="
122
+ - - "~>"
95
123
  - !ruby/object:Gem::Version
96
- version: '0'
124
+ version: '2.7'
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: simplecov
99
127
  requirement: !ruby/object:Gem::Requirement
@@ -122,7 +150,7 @@ dependencies:
122
150
  - - ">="
123
151
  - !ruby/object:Gem::Version
124
152
  version: '0'
125
- description: Official OmniAuth strategy for My MLH.
153
+ description: Official OmniAuth strategy for MyMLH.
126
154
  email:
127
155
  - swift@mlh.io
128
156
  executables: []
@@ -131,7 +159,7 @@ extra_rdoc_files: []
131
159
  files:
132
160
  - ".gitignore"
133
161
  - ".rspec"
134
- - ".ruby-version"
162
+ - ".rubocop.yml"
135
163
  - ".travis.yml"
136
164
  - Gemfile
137
165
  - LICENSE.txt
@@ -156,17 +184,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
156
184
  requirements:
157
185
  - - ">="
158
186
  - !ruby/object:Gem::Version
159
- version: 2.2.4
187
+ version: 2.2.0
160
188
  required_rubygems_version: !ruby/object:Gem::Requirement
161
189
  requirements:
162
190
  - - ">="
163
191
  - !ruby/object:Gem::Version
164
192
  version: '0'
165
193
  requirements: []
166
- rubygems_version: 3.0.8
194
+ rubygems_version: 3.2.33
167
195
  signing_key:
168
196
  specification_version: 4
169
- summary: Official OmniAuth strategy for My MLH.
197
+ summary: Official OmniAuth strategy for MyMLH.
170
198
  test_files:
171
199
  - spec/omniauth/mlh_spec.rb
172
200
  - spec/spec_helper.rb
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.2.4