omniauth-angellist 0.0.5 → 0.0.6
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 +6 -14
- data/lib/omniauth-angellist/version.rb +1 -1
- data/lib/omniauth/strategies/angellist.rb +26 -6
- data/spec/omniauth/strategies/angellist_spec.rb +51 -51
- metadata +10 -10
checksums.yaml
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
metadata.gz: !binary |-
|
|
9
|
-
MjRlN2MyZWNmNjk1MGVkNWFhZjMxZDY4MDc3M2UzNDc3YWFmYTU3YjljMzdj
|
|
10
|
-
MzI2MzlkOWM4YjBhMjg1Y2MyNDgwZjVlNmJkODkyZDI2MGMwYjU3Mzg2ZmUy
|
|
11
|
-
OGUyMDg3ZWVjNmRkMWU0YmJiYWU2MWY0YjRjOWRjNTkyMzg4MGM=
|
|
12
|
-
data.tar.gz: !binary |-
|
|
13
|
-
NmI5MWU1OWFjMWU3YjZlODQ3NGY1YWU3MDA2NGFkYTI0OWE1NGFlYzc5Y2Qx
|
|
14
|
-
ZmRiMjg3OWNlN2E0MTcyY2E3MjhkZTRkYWQ5MTVkOTM0MTg4MjUzMjliNTUy
|
|
15
|
-
MTczY2JjMGRmZTgyY2ViMGFmZTM0N2M1YTJjNzFiN2RjYWI0Zjg=
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 5d02de312e74a1c39067c64ec3795cce577d54e1
|
|
4
|
+
data.tar.gz: 461c3811dd49d2676db0b94c6b9416195b43bdad
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 3575930f7915ae7b4c22d559da759e184ded99fe4dc0e36aa34a511604072bcb192c0aa5e49d87bf52ed2e8ef318adf358eb41404b7bd3f4fc5017789dcdc349
|
|
7
|
+
data.tar.gz: 767c0b1577b289ffe97e83f9df7b2b79ccef1f1e88963642491d5664d6fec051bce2334c017eb9af277f3124399164f7f9f002e4997acbdbc4b9f9c3671ba971
|
|
@@ -25,7 +25,7 @@ module OmniAuth
|
|
|
25
25
|
uid { raw_info['id'] }
|
|
26
26
|
|
|
27
27
|
info do
|
|
28
|
-
{
|
|
28
|
+
prune!({
|
|
29
29
|
"name" => raw_info["name"],
|
|
30
30
|
"email" => raw_info["email"],
|
|
31
31
|
"bio" => raw_info["bio"],
|
|
@@ -40,13 +40,25 @@ module OmniAuth
|
|
|
40
40
|
"roles" => raw_info["roles"],
|
|
41
41
|
"angellist_url" => raw_info["angellist_url"],
|
|
42
42
|
"image" => raw_info["image"],
|
|
43
|
-
"skills" => raw_info["skills"]
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
"skills" => raw_info["skills"]
|
|
44
|
+
})
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
credentials do
|
|
48
|
+
hash = {'token' => access_token.token}
|
|
49
|
+
hash.merge!('refresh_token' => access_token.refresh_token) if access_token.expires? && access_token.refresh_token
|
|
50
|
+
hash.merge!('expires_at' => access_token.expires_at) if access_token.expires?
|
|
51
|
+
hash.merge!('expires' => access_token.expires?)
|
|
52
|
+
hash.merge!('scope' => raw_info["scopes"] ? raw_info["scopes"].join(" ") : nil)
|
|
53
|
+
prune!(hash)
|
|
46
54
|
end
|
|
47
55
|
|
|
48
56
|
def raw_info
|
|
49
|
-
|
|
57
|
+
unless skip_info?
|
|
58
|
+
@raw_info ||= access_token.get('https://api.angel.co/1/me').parsed
|
|
59
|
+
else
|
|
60
|
+
{}
|
|
61
|
+
end
|
|
50
62
|
end
|
|
51
63
|
|
|
52
64
|
def authorize_params
|
|
@@ -63,8 +75,16 @@ module OmniAuth
|
|
|
63
75
|
params[:scope] ||= DEFAULT_SCOPE
|
|
64
76
|
end
|
|
65
77
|
end
|
|
78
|
+
|
|
79
|
+
private
|
|
80
|
+
def prune!(hash)
|
|
81
|
+
hash.delete_if do |_, value|
|
|
82
|
+
prune!(value) if value.is_a?(Hash)
|
|
83
|
+
value.nil? || (value.respond_to?(:empty?) && value.empty?)
|
|
84
|
+
end
|
|
85
|
+
end
|
|
66
86
|
end
|
|
67
87
|
end
|
|
68
88
|
end
|
|
69
89
|
|
|
70
|
-
OmniAuth.config.add_camelization 'angellist', 'AngelList'
|
|
90
|
+
OmniAuth.config.add_camelization 'angellist', 'AngelList'
|
|
@@ -7,8 +7,41 @@ describe OmniAuth::Strategies::AngelList do
|
|
|
7
7
|
@request.stub(:params) { {} }
|
|
8
8
|
@client_id = '123'
|
|
9
9
|
@client_secret = 'afalsf'
|
|
10
|
+
@raw_info = {
|
|
11
|
+
'name' => 'Sebastian Rabuini',
|
|
12
|
+
'email' => 'sebas@wasabit.com.ar',
|
|
13
|
+
'bio' => 'Sebas',
|
|
14
|
+
'blog_url' => 'sebas_blog',
|
|
15
|
+
'online_bio_url' => 'http://wasabitlabs.com',
|
|
16
|
+
'twitter_url' => 'http://twitter.com/#!/sebasr',
|
|
17
|
+
'facebook_url' => 'http://www.facebook.com/sebastian.rabuini',
|
|
18
|
+
'linkedin_url' => 'http://www.linkedin.com/in/srabuini',
|
|
19
|
+
'follower_count' => 6,
|
|
20
|
+
'investor' => false,
|
|
21
|
+
'locations' => [
|
|
22
|
+
{'id' => 1963, 'tag_type' => 'LocationTag', 'name' => 'buenos aires',
|
|
23
|
+
'display_name' => 'Buenos Aires',
|
|
24
|
+
'angellist_url' => 'https://angel.co/buenos-aires'}
|
|
25
|
+
],
|
|
26
|
+
'roles' => [
|
|
27
|
+
{'id' => 14726, 'tag_type' => 'RoleTag', 'name' => 'developer',
|
|
28
|
+
'display_name' => 'Developer',
|
|
29
|
+
'angellist_url' => 'https://angel.co/developer'},
|
|
30
|
+
{'id' => 14725, 'tag_type' => 'RoleTag', 'name' => 'entrepreneur',
|
|
31
|
+
'display_name' => 'Entrepreneur',
|
|
32
|
+
'angellist_url' => 'https://angel.co/entrepreneur-1'}
|
|
33
|
+
],
|
|
34
|
+
'skills' => [
|
|
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
|
+
],
|
|
39
|
+
'scopes' => ["email","comment","message","talent"],
|
|
40
|
+
'angellist_url' => 'https://angel.co/sebasr',
|
|
41
|
+
'image' => 'https://s3.amazonaws.com/photos.angel.co/users/90585-medium_jpg?1327684569'
|
|
42
|
+
}
|
|
10
43
|
end
|
|
11
|
-
|
|
44
|
+
|
|
12
45
|
subject do
|
|
13
46
|
args = [@client_id, @client_secret, @options].compact
|
|
14
47
|
OmniAuth::Strategies::AngelList.new(nil, *args).tap do |strategy|
|
|
@@ -34,42 +67,9 @@ describe OmniAuth::Strategies::AngelList do
|
|
|
34
67
|
|
|
35
68
|
describe '#info' do
|
|
36
69
|
before :each do
|
|
37
|
-
@raw_info = {
|
|
38
|
-
'name' => 'Sebastian Rabuini',
|
|
39
|
-
'email' => 'sebas@wasabit.com.ar',
|
|
40
|
-
'bio' => 'Sebas',
|
|
41
|
-
'blog_url' => 'sebas_blog',
|
|
42
|
-
'online_bio_url' => 'http://wasabitlabs.com',
|
|
43
|
-
'twitter_url' => 'http://twitter.com/#!/sebasr',
|
|
44
|
-
'facebook_url' => 'http://www.facebook.com/sebastian.rabuini',
|
|
45
|
-
'linkedin_url' => 'http://www.linkedin.com/in/srabuini',
|
|
46
|
-
'follower_count' => 6,
|
|
47
|
-
'investor' => false,
|
|
48
|
-
'locations' => [
|
|
49
|
-
{'id' => 1963, 'tag_type' => 'LocationTag', 'name' => 'buenos aires',
|
|
50
|
-
'display_name' => 'Buenos Aires',
|
|
51
|
-
'angellist_url' => 'https://angel.co/buenos-aires'}
|
|
52
|
-
],
|
|
53
|
-
'roles' => [
|
|
54
|
-
{'id' => 14726, 'tag_type' => 'RoleTag', 'name' => 'developer',
|
|
55
|
-
'display_name' => 'Developer',
|
|
56
|
-
'angellist_url' => 'https://angel.co/developer'},
|
|
57
|
-
{'id' => 14725, 'tag_type' => 'RoleTag', 'name' => 'entrepreneur',
|
|
58
|
-
'display_name' => 'Entrepreneur',
|
|
59
|
-
'angellist_url' => 'https://angel.co/entrepreneur-1'}
|
|
60
|
-
],
|
|
61
|
-
'skills' => [
|
|
62
|
-
{"id" => 82532, "tag_type" => "SkillTag", "name" => "ruby on rails",
|
|
63
|
-
"display_name" => "Ruby on Rails",
|
|
64
|
-
"angellist_url" => "https://angel.co/ruby-on-rails-1"}
|
|
65
|
-
],
|
|
66
|
-
'scopes' => ["email","comment","message","talent"],
|
|
67
|
-
'angellist_url' => 'https://angel.co/sebasr',
|
|
68
|
-
'image' => 'https://s3.amazonaws.com/photos.angel.co/users/90585-medium_jpg?1327684569'
|
|
69
|
-
}
|
|
70
70
|
subject.stub(:raw_info) { @raw_info }
|
|
71
71
|
end
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
context 'when data is present in raw info' do
|
|
74
74
|
it 'returns the combined name' do
|
|
75
75
|
subject.info['name'].should eq('Sebastian Rabuini')
|
|
@@ -78,7 +78,7 @@ describe OmniAuth::Strategies::AngelList do
|
|
|
78
78
|
it 'returns the bio' do
|
|
79
79
|
subject.info['bio'].should eq('Sebas')
|
|
80
80
|
end
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
it 'returns the image' do
|
|
83
83
|
subject.info['image'].should eq(@raw_info['image'])
|
|
84
84
|
end
|
|
@@ -87,10 +87,6 @@ describe OmniAuth::Strategies::AngelList do
|
|
|
87
87
|
subject.info['email'].should eq('sebas@wasabit.com.ar')
|
|
88
88
|
end
|
|
89
89
|
|
|
90
|
-
it "return scopes" do
|
|
91
|
-
subject.info['scopes'].should eq(["email","comment","message","talent"])
|
|
92
|
-
end
|
|
93
|
-
|
|
94
90
|
it "return skills" do
|
|
95
91
|
subject.info['skills'].first['name'].should eq("ruby on rails")
|
|
96
92
|
end
|
|
@@ -106,34 +102,38 @@ describe OmniAuth::Strategies::AngelList do
|
|
|
106
102
|
subject.authorize_params['scope'].should eq('email')
|
|
107
103
|
end
|
|
108
104
|
end
|
|
109
|
-
|
|
105
|
+
|
|
110
106
|
describe '#credentials' do
|
|
111
107
|
before :each do
|
|
112
108
|
@access_token = double('OAuth2::AccessToken')
|
|
113
|
-
@access_token.stub(:token)
|
|
109
|
+
@access_token.stub(:token) { '123' } # Token is always required
|
|
114
110
|
@access_token.stub(:expires?)
|
|
115
111
|
@access_token.stub(:expires_at)
|
|
116
112
|
@access_token.stub(:refresh_token)
|
|
117
113
|
subject.stub(:access_token) { @access_token }
|
|
114
|
+
subject.stub(:raw_info) { @raw_info }
|
|
118
115
|
end
|
|
119
|
-
|
|
116
|
+
|
|
120
117
|
it 'returns a Hash' do
|
|
121
118
|
subject.credentials.should be_a(Hash)
|
|
122
119
|
end
|
|
123
|
-
|
|
120
|
+
|
|
124
121
|
it 'returns the token' do
|
|
125
|
-
@access_token.stub(:token) { '123' }
|
|
126
122
|
subject.credentials['token'].should eq('123')
|
|
127
123
|
end
|
|
128
|
-
|
|
124
|
+
|
|
125
|
+
it "return scopes" do
|
|
126
|
+
subject.credentials['scope'].should eq("email comment message talent")
|
|
127
|
+
end
|
|
128
|
+
|
|
129
129
|
it 'returns the expiry status' do
|
|
130
130
|
@access_token.stub(:expires?) { true }
|
|
131
131
|
subject.credentials['expires'].should eq(true)
|
|
132
|
-
|
|
132
|
+
|
|
133
133
|
@access_token.stub(:expires?) { false }
|
|
134
134
|
subject.credentials['expires'].should eq(false)
|
|
135
135
|
end
|
|
136
|
-
|
|
136
|
+
|
|
137
137
|
it 'returns the refresh token and expiry time when expiring' do
|
|
138
138
|
ten_mins_from_now = (Time.now + 360).to_i
|
|
139
139
|
@access_token.stub(:expires?) { true }
|
|
@@ -142,14 +142,14 @@ describe OmniAuth::Strategies::AngelList do
|
|
|
142
142
|
subject.credentials['refresh_token'].should eq('321')
|
|
143
143
|
subject.credentials['expires_at'].should eq(ten_mins_from_now)
|
|
144
144
|
end
|
|
145
|
-
|
|
145
|
+
|
|
146
146
|
it 'does not return the refresh token when it is nil and expiring' do
|
|
147
147
|
@access_token.stub(:expires?) { true }
|
|
148
148
|
@access_token.stub(:refresh_token) { nil }
|
|
149
149
|
subject.credentials['refresh_token'].should be_nil
|
|
150
150
|
subject.credentials.should_not have_key('refresh_token')
|
|
151
151
|
end
|
|
152
|
-
|
|
152
|
+
|
|
153
153
|
it 'does not return the refresh token when not expiring' do
|
|
154
154
|
@access_token.stub(:expires?) { false }
|
|
155
155
|
@access_token.stub(:refresh_token) { 'XXX' }
|
|
@@ -157,4 +157,4 @@ describe OmniAuth::Strategies::AngelList do
|
|
|
157
157
|
subject.credentials.should_not have_key('refresh_token')
|
|
158
158
|
end
|
|
159
159
|
end
|
|
160
|
-
end
|
|
160
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omniauth-angellist
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sebastian Rabuini
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-07-
|
|
11
|
+
date: 2013-07-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: omniauth-oauth2
|
|
@@ -42,42 +42,42 @@ dependencies:
|
|
|
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
|
|
@@ -107,12 +107,12 @@ require_paths:
|
|
|
107
107
|
- lib
|
|
108
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
109
|
requirements:
|
|
110
|
-
- -
|
|
110
|
+
- - '>='
|
|
111
111
|
- !ruby/object:Gem::Version
|
|
112
112
|
version: '0'
|
|
113
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
|
115
|
-
- -
|
|
115
|
+
- - '>='
|
|
116
116
|
- !ruby/object:Gem::Version
|
|
117
117
|
version: '0'
|
|
118
118
|
requirements: []
|