omniauth-studentbeans 0.0.1
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 +7 -0
- data/.gitignore +15 -0
- data/CHANGELOG.md +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +37 -0
- data/Rakefile +1 -0
- data/lib/omniauth/strategies/studentbeans.rb +48 -0
- data/lib/omniauth/studentbeans.rb +2 -0
- data/lib/omniauth/studentbeans/version.rb +5 -0
- data/omniauth-studentbeans.gemspec +25 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c6aaf163e3c1fbf7e4bc986c8b0c8ea342e987c5
|
4
|
+
data.tar.gz: c3af00c15bb842adb5aa027eb650ddf023c6793d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1078ff35b0cc4b4c7a2a123b6cb4749dbe1df18d58d69a17ec9ead3d8dab1c0ca01d60400e5be3007422251a6c0cff4fb067e2ded31993f664b5c37ef12c1f9c
|
7
|
+
data.tar.gz: 5e464b8ac735d9edd772c1afbfcd96fa8065391d92fc88d12803de3e01ecbd7e7d541c87809b2afee853454c93b4d5dd89e8db9a82289b0d5fb6376c379815d5
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Seren Altiner
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Omniauth::Studentbeans
|
2
|
+
|
3
|
+
Student Beans OAuth2 strategy for OmniAuth
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```rubygems
|
10
|
+
gem 'omniauth-studentbeans'
|
11
|
+
```
|
12
|
+
|
13
|
+
or
|
14
|
+
|
15
|
+
```github
|
16
|
+
gem 'omniauth-studentbeans', git: 'https://github.com/thebeansgroup/omniauth-studentbeans'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install omniauth-studentbeans
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
`OmniAuth::Strategies::Studentbeans` is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.
|
30
|
+
|
31
|
+
Here's a quick example, adding the middleware to a Rails app in config/initializers/omniauth.rb:
|
32
|
+
|
33
|
+
```
|
34
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
35
|
+
provider :studentbeans, ENV['STUDENTBEANS_KEY'], ENV['STUDENTBEANS_SECRET']
|
36
|
+
end
|
37
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'omniauth/strategies/oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Studentbeans < OmniAuth::Strategies::OAuth2
|
6
|
+
option :client_options, {
|
7
|
+
site: 'https://www.studentbeans.com',
|
8
|
+
authorize_url: '/verge/authorize',
|
9
|
+
token_url: '/oauth/token'
|
10
|
+
}
|
11
|
+
|
12
|
+
uid { raw_info['id'] }
|
13
|
+
|
14
|
+
info do
|
15
|
+
profile_info = raw_info['profile'] || {}
|
16
|
+
student_verification_info = profile_info['student_verification'] || {}
|
17
|
+
|
18
|
+
prune!({
|
19
|
+
'email' => raw_info['email'],
|
20
|
+
'first_name' => profile_info['first_name'],
|
21
|
+
'last_name' => profile_info['last_name'],
|
22
|
+
'university' => student_verification_info['university'],
|
23
|
+
'university_email' => student_verification_info['email'],
|
24
|
+
'status' => student_verification_info['status']
|
25
|
+
})
|
26
|
+
end
|
27
|
+
|
28
|
+
extra do
|
29
|
+
hash = {}
|
30
|
+
hash['raw_info'] = raw_info unless skip_info?
|
31
|
+
prune! hash
|
32
|
+
end
|
33
|
+
|
34
|
+
def raw_info
|
35
|
+
@raw_info ||= access_token.get('/api/v1/me.json').parsed || {}
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def prune!(hash)
|
41
|
+
hash.delete_if do |_, value|
|
42
|
+
prune!(value) if value.is_a?(Hash)
|
43
|
+
value.nil? || (value.respond_to?(:empty?) && value.empty?)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth/studentbeans/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'omniauth-studentbeans'
|
8
|
+
spec.version = OmniAuth::Studentbeans::VERSION
|
9
|
+
spec.authors = ['Seren Altiner', 'Vincent Siebert']
|
10
|
+
spec.email = ['seren@thebeansgroup.com', 'vincent@siebert.im']
|
11
|
+
spec.summary = 'Student Beans OAuth2 strategy for OmniAuth'
|
12
|
+
spec.homepage = 'https://github.com/thebeansgroup/omniauth-studentbeans'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_runtime_dependency 'omniauth'
|
21
|
+
spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.2'
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-studentbeans
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Seren Altiner
|
8
|
+
- Vincent Siebert
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-03-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: omniauth-oauth2
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.2'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.2'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: bundler
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.6'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.6'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rake
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '10.0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '10.0'
|
70
|
+
description:
|
71
|
+
email:
|
72
|
+
- seren@thebeansgroup.com
|
73
|
+
- vincent@siebert.im
|
74
|
+
executables: []
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- ".gitignore"
|
79
|
+
- CHANGELOG.md
|
80
|
+
- Gemfile
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- lib/omniauth/strategies/studentbeans.rb
|
85
|
+
- lib/omniauth/studentbeans.rb
|
86
|
+
- lib/omniauth/studentbeans/version.rb
|
87
|
+
- omniauth-studentbeans.gemspec
|
88
|
+
homepage: https://github.com/thebeansgroup/omniauth-studentbeans
|
89
|
+
licenses:
|
90
|
+
- MIT
|
91
|
+
metadata: {}
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options: []
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
requirements: []
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 2.2.2
|
109
|
+
signing_key:
|
110
|
+
specification_version: 4
|
111
|
+
summary: Student Beans OAuth2 strategy for OmniAuth
|
112
|
+
test_files: []
|
113
|
+
has_rdoc:
|