omniauth-angellist 0.0.7 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -2
- data/README.md +4 -4
- data/Rakefile +2 -3
- data/lib/omniauth/strategies/angellist.rb +37 -38
- data/lib/omniauth-angellist/version.rb +1 -1
- data/lib/omniauth-angellist.rb +2 -2
- data/omniauth-angellist.gemspec +12 -13
- data/spec/omniauth/strategies/angellist_spec.rb +16 -16
- data/spec/spec_helper.rb +1 -3
- data/spec/support/shared_examples.rb +7 -7
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7fcf72d337a95f545086adb06cbfa76da04769a
|
4
|
+
data.tar.gz: 93e9c47c0b32cf70b8919e2165047309bbd99ff2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5350bee46f7b08f55208773c97262aa5b9a80de9661919e807881cdccd52619b0a9eaef31ad40a2b2b93dea991ad2e2e2b6cbd43cfcad2bd2b6634b1c8b2712c
|
7
|
+
data.tar.gz: f149fee4067aa28c82a9c688bd3b8915d9ecd7398456dbfcf6d2303176e537baf366aa05177c882aed4067724ed03786717f0b4d6acddc8fc4a7dafc23efe186
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
This gem contains the AngelList strategy for OmniAuth.
|
4
4
|
|
5
|
-
AngelList uses the OAuth2 flow, you can read about it here:
|
5
|
+
AngelList uses the OAuth2 flow, you can read about it here: https://angel.co/api/oauth/faq
|
6
6
|
|
7
7
|
## How To Use It
|
8
8
|
|
@@ -17,10 +17,10 @@ You can pull them in directly from github e.g.:
|
|
17
17
|
Once these are in, you need to add the following to your `config/initializers/omniauth.rb`:
|
18
18
|
|
19
19
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
20
|
-
provider :angellist, "consumer_key", "consumer_secret"
|
20
|
+
provider :angellist, "consumer_key", "consumer_secret"
|
21
21
|
end
|
22
22
|
|
23
|
-
You will obviously have to put in your key and secret, which you get when you register your app with AngelList (they call them API Key and Secret Key).
|
23
|
+
You will obviously have to put in your key and secret, which you get when you register your app with AngelList (they call them API Key and Secret Key).
|
24
24
|
|
25
25
|
Now just follow the README at: https://github.com/intridea/omniauth
|
26
26
|
|
@@ -32,4 +32,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
32
32
|
|
33
33
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
34
34
|
|
35
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
35
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -6,14 +6,14 @@ module OmniAuth
|
|
6
6
|
DEFAULT_SCOPE = 'email'
|
7
7
|
|
8
8
|
option :client_options, {
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
9
|
+
site: 'https://angel.co/',
|
10
|
+
authorize_url: 'https://angel.co/api/oauth/authorize',
|
11
|
+
token_url: 'https://angel.co/api/oauth/token'
|
12
12
|
}
|
13
13
|
|
14
14
|
option :access_token_options, {
|
15
|
-
:
|
16
|
-
:
|
15
|
+
mode: :query,
|
16
|
+
header_format: 'OAuth %s'
|
17
17
|
}
|
18
18
|
|
19
19
|
option :provider_ignores_state, true
|
@@ -25,58 +25,57 @@ module OmniAuth
|
|
25
25
|
uid { raw_info['id'] }
|
26
26
|
|
27
27
|
info do
|
28
|
-
prune!({
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
"skills" => raw_info["skills"]
|
44
|
-
})
|
28
|
+
prune!({ 'name' => raw_info['name'],
|
29
|
+
'email' => raw_info['email'],
|
30
|
+
'bio' => raw_info['bio'],
|
31
|
+
'blog_url' => raw_info['blog_url'],
|
32
|
+
'online_bio_url' => raw_info['online_bio_url'],
|
33
|
+
'twitter_url' => raw_info['twitter_url'],
|
34
|
+
'facebook_url' => raw_info['facebook_url'],
|
35
|
+
'linkedin_url' => raw_info['linkedin_url'],
|
36
|
+
'follower_count' => raw_info['follower_count'],
|
37
|
+
'investor' => raw_info['investor'],
|
38
|
+
'locations' => raw_info['locations'],
|
39
|
+
'roles' => raw_info['roles'],
|
40
|
+
'angellist_url' => raw_info['angellist_url'],
|
41
|
+
'image' => raw_info['image'],
|
42
|
+
'skills' => raw_info['skills'] })
|
45
43
|
end
|
46
44
|
|
47
45
|
credentials do
|
48
|
-
hash = {'token' => access_token.token}
|
49
|
-
hash.merge!('refresh_token' => access_token.refresh_token) if
|
50
|
-
|
46
|
+
hash = { 'token' => access_token.token }
|
47
|
+
hash.merge!('refresh_token' => access_token.refresh_token) if
|
48
|
+
access_token.expires? && access_token.refresh_token
|
49
|
+
hash.merge!('expires_at' => access_token.expires_at) if
|
50
|
+
access_token.expires?
|
51
51
|
hash.merge!('expires' => access_token.expires?)
|
52
|
-
hash.merge!(
|
52
|
+
hash.merge!(
|
53
|
+
'scope' => raw_info['scopes'] ? raw_info['scopes'].join(' ') : nil)
|
53
54
|
prune!(hash)
|
54
55
|
end
|
55
56
|
|
56
57
|
def raw_info
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
{}
|
61
|
-
end
|
58
|
+
return {} if skip_info?
|
59
|
+
|
60
|
+
@raw_info ||= access_token.get('https://api.angel.co/1/me').parsed
|
62
61
|
end
|
63
62
|
|
64
63
|
def authorize_params
|
65
64
|
super.tap do |params|
|
66
|
-
%w
|
67
|
-
|
68
|
-
params[v.to_sym] = request.params[v]
|
65
|
+
%w(scope state).each do |value|
|
66
|
+
next unless request.params[value]
|
69
67
|
|
70
|
-
|
71
|
-
|
72
|
-
|
68
|
+
params[value.to_sym] = request.params[value]
|
69
|
+
|
70
|
+
session['omniauth.state'] = params[:state] if value == 'state'
|
73
71
|
end
|
74
72
|
|
75
73
|
params[:scope] ||= DEFAULT_SCOPE
|
76
74
|
end
|
77
75
|
end
|
78
76
|
|
79
|
-
|
77
|
+
private
|
78
|
+
|
80
79
|
def prune!(hash)
|
81
80
|
hash.delete_if do |_, value|
|
82
81
|
prune!(value) if value.is_a?(Hash)
|
data/lib/omniauth-angellist.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'omniauth-angellist/version'
|
2
|
+
require 'omniauth/strategies/angellist'
|
data/omniauth-angellist.gemspec
CHANGED
@@ -1,23 +1,22 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require "omniauth-angellist/version"
|
1
|
+
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
2
|
+
require 'omniauth-angellist/version'
|
4
3
|
|
5
4
|
Gem::Specification.new do |s|
|
6
|
-
s.name =
|
5
|
+
s.name = 'omniauth-angellist'
|
7
6
|
s.version = Omniauth::AngelList::VERSION
|
8
|
-
s.authors = [
|
9
|
-
s.email = [
|
10
|
-
s.homepage =
|
11
|
-
s.summary =
|
12
|
-
s.description =
|
13
|
-
s.license
|
7
|
+
s.authors = ['Sebastian Rabuini']
|
8
|
+
s.email = ['srabuini@gmail.com']
|
9
|
+
s.homepage = 'https://github.com/wasabit/omniauth-angellist'
|
10
|
+
s.summary = 'AngelList OAuth strategy for OmniAuth'
|
11
|
+
s.description = 'AngelList OAuth strategy for OmniAuth'
|
12
|
+
s.license = 'MIT'
|
14
13
|
|
15
|
-
s.rubyforge_project =
|
14
|
+
s.rubyforge_project = 'omniauth-angellist'
|
16
15
|
|
17
16
|
s.files = `git ls-files`.split("\n")
|
18
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
-
|
20
|
-
s.require_paths = [
|
18
|
+
|
19
|
+
s.require_paths = ['lib']
|
21
20
|
|
22
21
|
s.add_runtime_dependency 'omniauth-oauth2', '~> 1.1'
|
23
22
|
s.add_development_dependency 'rspec', '~> 2.7'
|
@@ -19,24 +19,24 @@ describe OmniAuth::Strategies::AngelList do
|
|
19
19
|
'follower_count' => 6,
|
20
20
|
'investor' => false,
|
21
21
|
'locations' => [
|
22
|
-
{'id' => 1963, 'tag_type' => 'LocationTag', 'name' => 'buenos aires',
|
22
|
+
{ 'id' => 1963, 'tag_type' => 'LocationTag', 'name' => 'buenos aires',
|
23
23
|
'display_name' => 'Buenos Aires',
|
24
|
-
'angellist_url' => 'https://angel.co/buenos-aires'}
|
24
|
+
'angellist_url' => 'https://angel.co/buenos-aires' }
|
25
25
|
],
|
26
26
|
'roles' => [
|
27
|
-
{'id' => 14726, 'tag_type' => 'RoleTag', 'name' => 'developer',
|
27
|
+
{ 'id' => 14726, 'tag_type' => 'RoleTag', 'name' => 'developer',
|
28
28
|
'display_name' => 'Developer',
|
29
|
-
'angellist_url' => 'https://angel.co/developer'},
|
30
|
-
{'id' => 14725, 'tag_type' => 'RoleTag', 'name' => 'entrepreneur',
|
29
|
+
'angellist_url' => 'https://angel.co/developer' },
|
30
|
+
{ 'id' => 14725, 'tag_type' => 'RoleTag', 'name' => 'entrepreneur',
|
31
31
|
'display_name' => 'Entrepreneur',
|
32
|
-
'angellist_url' => 'https://angel.co/entrepreneur-1'}
|
32
|
+
'angellist_url' => 'https://angel.co/entrepreneur-1' }
|
33
33
|
],
|
34
34
|
'skills' => [
|
35
|
-
{
|
36
|
-
|
37
|
-
|
35
|
+
{ 'id' => 82532, 'tag_type' => 'SkillTag', 'name' => 'ruby on rails',
|
36
|
+
'display_name' => 'Ruby on Rails',
|
37
|
+
'angellist_url' => 'https://angel.co/ruby-on-rails-1' }
|
38
38
|
],
|
39
|
-
'scopes' =>
|
39
|
+
'scopes' => %w(email comment message talent),
|
40
40
|
'angellist_url' => 'https://angel.co/sebasr',
|
41
41
|
'image' => 'https://s3.amazonaws.com/photos.angel.co/users/90585-medium_jpg?1327684569'
|
42
42
|
}
|
@@ -83,19 +83,19 @@ describe OmniAuth::Strategies::AngelList do
|
|
83
83
|
subject.info['image'].should eq(@raw_info['image'])
|
84
84
|
end
|
85
85
|
|
86
|
-
it
|
86
|
+
it 'return the email' do
|
87
87
|
subject.info['email'].should eq('sebas@wasabit.com.ar')
|
88
88
|
end
|
89
89
|
|
90
|
-
it
|
91
|
-
subject.info['skills'].first['name'].should eq(
|
90
|
+
it 'return skills' do
|
91
|
+
subject.info['skills'].first['name'].should eq('ruby on rails')
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
96
|
describe '#authorize_params' do
|
97
97
|
before :each do
|
98
|
-
subject.stub(:
|
98
|
+
subject.stub(session: {})
|
99
99
|
end
|
100
100
|
|
101
101
|
it 'includes default scope for email' do
|
@@ -122,8 +122,8 @@ describe OmniAuth::Strategies::AngelList do
|
|
122
122
|
subject.credentials['token'].should eq('123')
|
123
123
|
end
|
124
124
|
|
125
|
-
it
|
126
|
-
subject.credentials['scope'].should eq(
|
125
|
+
it 'return scopes' do
|
126
|
+
subject.credentials['scope'].should eq('email comment message talent')
|
127
127
|
end
|
128
128
|
|
129
129
|
it 'returns the expiry status' do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
# NOTE it would be useful if this lived in omniauth-oauth2 eventually
|
2
1
|
shared_examples 'an oauth2 strategy' do
|
3
2
|
describe '#client' do
|
4
3
|
it 'should be initialized with symbolized client_options' do
|
5
|
-
@options = { :
|
4
|
+
@options = { client_options:
|
5
|
+
{ 'authorize_url' => 'https://example.com' } }
|
6
6
|
subject.client.options[:authorize_url].should == 'https://example.com'
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
10
|
describe '#token_params' do
|
11
|
-
it 'should include any
|
12
|
-
@options = { :
|
11
|
+
it 'should include any params passed in the :authorize_params option' do
|
12
|
+
@options = { token_params: { foo: 'bar', baz: 'zip' } }
|
13
13
|
subject.token_params['foo'].should eq('bar')
|
14
14
|
subject.token_params['baz'].should eq('zip')
|
15
15
|
end
|
16
16
|
|
17
|
-
it 'should include top-level options
|
18
|
-
@options = { :
|
17
|
+
it 'should include top-level options marked as :authorize_options' do
|
18
|
+
@options = { token_options: [:scope, :foo], scope: 'bar', foo: 'baz' }
|
19
19
|
subject.token_params['scope'].should eq('bar')
|
20
20
|
subject.token_params['foo'].should eq('baz')
|
21
21
|
end
|
22
22
|
end
|
23
|
-
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-angellist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Rabuini
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.7'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.7'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rack-test
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: simplecov
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: webmock
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: AngelList OAuth strategy for OmniAuth
|
@@ -87,7 +87,7 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- .gitignore
|
90
|
+
- ".gitignore"
|
91
91
|
- Gemfile
|
92
92
|
- README.md
|
93
93
|
- Rakefile
|
@@ -108,17 +108,17 @@ require_paths:
|
|
108
108
|
- lib
|
109
109
|
required_ruby_version: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
|
-
- -
|
111
|
+
- - ">="
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: '0'
|
114
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- -
|
116
|
+
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project: omniauth-angellist
|
121
|
-
rubygems_version: 2.
|
121
|
+
rubygems_version: 2.4.5
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: AngelList OAuth strategy for OmniAuth
|