omniauth-mlh 0.1.2

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
+ SHA1:
3
+ metadata.gz: 11f66f85a16ee18dbb0687da32113fb50b23aba6
4
+ data.tar.gz: 521de249394f97c85459f60cfae1d57ce669e3ab
5
+ SHA512:
6
+ metadata.gz: c2773e523ed89e4fe39e5d06c57a2986211513f820a1d1f4a6fdf75b627582346a3118809faafdcc8bbd6b219cc9492c02e9350e4b305c1a809c2c8924659c37
7
+ data.tar.gz: 0706c5df4fa7f8223e4ace2ba84eb0f8997b9c5a09c684d43112bde58093516685ae20fbb1e445090f78cdb069193f50941dcd47e8245e9b764f9ef0fb2a44be
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.gem
11
+ *.rbc
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-mlh.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Major League Hacking
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,44 @@
1
+ # OmniAuth MLH
2
+
3
+ This is the official OmniAuth strategy for authenticating to My MLH. To use
4
+ it, you'll need to sign up for an OAuth2 Application ID and Secret on the
5
+ [My MLH Applications Page](https://my.mlh.io/oauth/applications).
6
+
7
+ # Usage
8
+
9
+ ```
10
+ use OmniAuth::Builder do
11
+ provider :mlh, ENV['MLH_KEY'], ENV['MLH_SECRET']
12
+ end
13
+ ```
14
+
15
+ ## Installation
16
+
17
+ Add this line to your application's Gemfile:
18
+
19
+ ```ruby
20
+ gem 'omniauth-mlh'
21
+ ```
22
+
23
+ And then execute:
24
+
25
+ $ bundle
26
+
27
+ Or install it yourself as:
28
+
29
+ $ gem install omniauth-mlh
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it ( https://github.com/mlh/omniauth-mlh/fork )
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create a new Pull Request
38
+
39
+ ## Questions?
40
+
41
+ Have a question about the API or this library? Start by checking out the
42
+ [official My MLH documentation](https://my.mlh.io/docs). If you still can't
43
+ find an answer, tweet at [@MLHacks](http://twitter.com/mlhacks) or drop an
44
+ email to [hi@mlh.io](mailto://hi@mlh.io).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new
6
+
7
+ desc 'Run specs'
8
+ task :default => :spec
@@ -0,0 +1,45 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class MLH < OmniAuth::Strategies::OAuth2
6
+ option :name, :mlh
7
+
8
+ option :client_options, {
9
+ :site => 'https://my.mlh.io',
10
+ :authorize_path => '/oauth/authorize',
11
+ :token_path => '/oauth/token'
12
+ }
13
+
14
+ uid { raw_info['data']['id'] }
15
+
16
+ info do
17
+ {
18
+ :email => raw_info['data']['email'],
19
+ :created_at => raw_info['data']['created_at'],
20
+ :updated_at => raw_info['data']['updated_at'],
21
+ :first_name => raw_info['data']['first_name'],
22
+ :last_name => raw_info['data']['last_name'],
23
+ :graduation => raw_info['data']['graduation'],
24
+ :major => raw_info['data']['major'],
25
+ :shirt_size => raw_info['data']['shirt_size'],
26
+ :dietary_restrictions => raw_info['data']['dietary_restrictions'],
27
+ :special_needs => raw_info['data']['special_needs'],
28
+ :date_of_birth => raw_info['data']['date_of_birth'],
29
+ :gender => raw_info['data']['gender'],
30
+ :phone_number => raw_info['data']['phone_number'],
31
+ :school => {
32
+ :id => raw_info['data']['school']['id'],
33
+ :name => raw_info['data']['school']['name'],
34
+ }
35
+ }
36
+ end
37
+
38
+ def raw_info
39
+ @raw_info ||= access_token.get('/api/v1/user.json').parsed
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ OmniAuth.config.add_camelization 'mlh', 'MLH'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module MLH
3
+ VERSION = "0.1.2"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require "omniauth-mlh/version"
2
+ require "omniauth/strategies/mlh"
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'omniauth-mlh/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "omniauth-mlh"
8
+ spec.version = OmniAuth::MLH::VERSION
9
+ spec.authors = ["Swift"]
10
+ spec.email = ["swift@mlh.io"]
11
+
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"
16
+
17
+ spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ spec.files = `git ls-files`.split("\n")
19
+ spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency 'omniauth', '~> 1.0'
23
+ spec.add_dependency 'omniauth-oauth2', '>= 1.1.1', '< 2.0'
24
+
25
+ spec.add_development_dependency 'rspec', '~> 2.7'
26
+ spec.add_development_dependency 'rack-test'
27
+ spec.add_development_dependency 'simplecov'
28
+ spec.add_development_dependency 'webmock'
29
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::MLH do
4
+ subject do
5
+ OmniAuth::Strategies::MLH.new({})
6
+ end
7
+
8
+ context "client options" do
9
+ it 'should have correct site' do
10
+ expect(subject.options.client_options.site).to eq('https://my.mlh.io')
11
+ end
12
+
13
+ it 'should have correct authorize url' do
14
+ expect(subject.options.client_options.authorize_path).to eq('/oauth/authorize')
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,14 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'simplecov'
3
+ SimpleCov.start
4
+ require 'rspec'
5
+ require 'rack/test'
6
+ require 'webmock/rspec'
7
+ require 'omniauth'
8
+ require 'omniauth-mlh'
9
+
10
+ RSpec.configure do |config|
11
+ config.include WebMock::API
12
+ config.include Rack::Test::Methods
13
+ config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
14
+ end
metadata ADDED
@@ -0,0 +1,149 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-mlh
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - Swift
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-09-03 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: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.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.1.1
34
+ - - <
35
+ - !ruby/object:Gem::Version
36
+ version: '2.0'
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 1.1.1
44
+ - - <
45
+ - !ruby/object:Gem::Version
46
+ version: '2.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '2.7'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ version: '2.7'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rack-test
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: simplecov
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: webmock
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ description: Official OmniAuth strategy for My MLH.
104
+ email:
105
+ - swift@mlh.io
106
+ executables: []
107
+ extensions: []
108
+ extra_rdoc_files: []
109
+ files:
110
+ - .gitignore
111
+ - .rspec
112
+ - .travis.yml
113
+ - Gemfile
114
+ - LICENSE.txt
115
+ - README.md
116
+ - Rakefile
117
+ - lib/omniauth-mlh.rb
118
+ - lib/omniauth-mlh/version.rb
119
+ - lib/omniauth/strategies/mlh.rb
120
+ - omniauth-mlh.gemspec
121
+ - spec/omniauth/mlh_spec.rb
122
+ - spec/spec_helper.rb
123
+ homepage: http://github.com/mlh/omniauth-mlh
124
+ licenses:
125
+ - MIT
126
+ metadata: {}
127
+ post_install_message:
128
+ rdoc_options: []
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ requirements: []
142
+ rubyforge_project:
143
+ rubygems_version: 2.0.14
144
+ signing_key:
145
+ specification_version: 4
146
+ summary: Official OmniAuth strategy for My MLH.
147
+ test_files:
148
+ - spec/omniauth/mlh_spec.rb
149
+ - spec/spec_helper.rb