omniauth-smarterer 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +8 -0
- data/README.md +3 -0
- data/Rakefile +45 -0
- data/VERSION +1 -0
- data/lib/omniauth-smarterer.rb +2 -0
- data/lib/omniauth-smarterer/version.rb +5 -0
- data/lib/omniauth/strategies/smarterer.rb +59 -0
- data/omniauth-smarterer.gemspec +70 -0
- metadata +201 -0
data/Gemfile
ADDED
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "omniauth-smarterer"
|
18
|
+
gem.homepage = "http://github.com/sandboxws/omniauth-smarterer"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{OmniAuth strategy for smarterer}
|
21
|
+
gem.description = %Q{OmniAuth strategy for smarterer}
|
22
|
+
gem.email = "aelhussaini@gmail.com"
|
23
|
+
gem.authors = ["Ahmed El.Hussaini"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
task :default => :test
|
36
|
+
|
37
|
+
require 'rdoc/task'
|
38
|
+
Rake::RDocTask.new do |rdoc|
|
39
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
40
|
+
|
41
|
+
rdoc.rdoc_dir = 'rdoc'
|
42
|
+
rdoc.title = "omniauth-smarterer #{version}"
|
43
|
+
rdoc.rdoc_files.include('README*')
|
44
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.0
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
require "multi_json"
|
3
|
+
require "rest-client"
|
4
|
+
|
5
|
+
module OmniAuth
|
6
|
+
module Strategies
|
7
|
+
class Smarterer < OmniAuth::Strategies::OAuth2
|
8
|
+
|
9
|
+
option :client_options, {
|
10
|
+
site: 'https://smarterer.com/',
|
11
|
+
authorize_url: 'https://smarterer.com/oauth/authorize',
|
12
|
+
token_url: 'https://smarterer.com/oauth/access_token',
|
13
|
+
token_method: :get
|
14
|
+
}
|
15
|
+
|
16
|
+
option :provider_ignores_state, true
|
17
|
+
|
18
|
+
def request_phase
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
def callback_phase
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
uid { raw_info['username'].to_s }
|
27
|
+
|
28
|
+
info do
|
29
|
+
{
|
30
|
+
username: raw_info['username'],
|
31
|
+
first_name: raw_info['first_name'],
|
32
|
+
last_name: raw_info['last_name'],
|
33
|
+
full_name: "#{raw_info['first_name']} #{raw_info['last_name']}",
|
34
|
+
bio: raw_info['bio'],
|
35
|
+
image: raw_info['profile_image'],
|
36
|
+
url: raw_info['link'],
|
37
|
+
location: raw_info['location'],
|
38
|
+
organization: raw_info['organization']
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
extra do
|
43
|
+
{raw_info: raw_info}
|
44
|
+
end
|
45
|
+
|
46
|
+
def raw_info
|
47
|
+
if @raw_info.nil?
|
48
|
+
@raw_info = {}
|
49
|
+
params = {access_token: access_token.token}
|
50
|
+
response = RestClient.get('https://smarterer.com/api/users/me', { :params => params })
|
51
|
+
user = MultiJson.decode(response.to_s)
|
52
|
+
@raw_info.merge!(user)
|
53
|
+
end
|
54
|
+
|
55
|
+
@raw_info
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "omniauth-smarterer"
|
8
|
+
s.version = "0.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Ahmed El.Hussaini"]
|
12
|
+
s.date = "2013-01-09"
|
13
|
+
s.description = "OmniAuth strategy for smarterer"
|
14
|
+
s.email = "aelhussaini@gmail.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.md"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
"Gemfile",
|
20
|
+
"README.md",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"lib/omniauth-smarterer.rb",
|
24
|
+
"lib/omniauth-smarterer/version.rb",
|
25
|
+
"lib/omniauth/strategies/smarterer.rb",
|
26
|
+
"omniauth-smarterer.gemspec"
|
27
|
+
]
|
28
|
+
s.homepage = "http://github.com/sandboxws/omniauth-smarterer"
|
29
|
+
s.licenses = ["MIT"]
|
30
|
+
s.require_paths = ["lib"]
|
31
|
+
s.rubygems_version = "1.8.24"
|
32
|
+
s.summary = "OmniAuth strategy for smarterer"
|
33
|
+
|
34
|
+
if s.respond_to? :specification_version then
|
35
|
+
s.specification_version = 3
|
36
|
+
|
37
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
38
|
+
s.add_runtime_dependency(%q<omniauth-smarterer>, [">= 0"])
|
39
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
40
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
41
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
42
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
43
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
44
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
45
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
46
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
47
|
+
else
|
48
|
+
s.add_dependency(%q<omniauth-smarterer>, [">= 0"])
|
49
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
50
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
51
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
52
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
53
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
54
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
55
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
56
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
57
|
+
end
|
58
|
+
else
|
59
|
+
s.add_dependency(%q<omniauth-smarterer>, [">= 0"])
|
60
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
61
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
62
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
63
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
64
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
65
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
66
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
67
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
metadata
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-smarterer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ahmed El.Hussaini
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-09 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth-smarterer
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: jeweler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.8.4
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.8.4
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: jeweler
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.8.4
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.8.4
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: jeweler
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.8.4
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.8.4
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: jeweler
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 1.8.4
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.8.4
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: jeweler
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 1.8.4
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.8.4
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: jeweler
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.8.4
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 1.8.4
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: jeweler
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ~>
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 1.8.4
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ~>
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 1.8.4
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: jeweler
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ~>
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: 1.8.4
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ~>
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: 1.8.4
|
158
|
+
description: OmniAuth strategy for smarterer
|
159
|
+
email: aelhussaini@gmail.com
|
160
|
+
executables: []
|
161
|
+
extensions: []
|
162
|
+
extra_rdoc_files:
|
163
|
+
- README.md
|
164
|
+
files:
|
165
|
+
- Gemfile
|
166
|
+
- README.md
|
167
|
+
- Rakefile
|
168
|
+
- VERSION
|
169
|
+
- lib/omniauth-smarterer.rb
|
170
|
+
- lib/omniauth-smarterer/version.rb
|
171
|
+
- lib/omniauth/strategies/smarterer.rb
|
172
|
+
- omniauth-smarterer.gemspec
|
173
|
+
homepage: http://github.com/sandboxws/omniauth-smarterer
|
174
|
+
licenses:
|
175
|
+
- MIT
|
176
|
+
post_install_message:
|
177
|
+
rdoc_options: []
|
178
|
+
require_paths:
|
179
|
+
- lib
|
180
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
181
|
+
none: false
|
182
|
+
requirements:
|
183
|
+
- - ! '>='
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
186
|
+
segments:
|
187
|
+
- 0
|
188
|
+
hash: -59972536434349685
|
189
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
|
+
none: false
|
191
|
+
requirements:
|
192
|
+
- - ! '>='
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
195
|
+
requirements: []
|
196
|
+
rubyforge_project:
|
197
|
+
rubygems_version: 1.8.24
|
198
|
+
signing_key:
|
199
|
+
specification_version: 3
|
200
|
+
summary: OmniAuth strategy for smarterer
|
201
|
+
test_files: []
|