oa-oauth 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/omniauth/oauth.rb +1 -0
- data/lib/omniauth/strategies/foursquare.rb +39 -0
- metadata +8 -7
data/lib/omniauth/oauth.rb
CHANGED
@@ -10,5 +10,6 @@ module OmniAuth
|
|
10
10
|
autoload :Facebook, 'omniauth/strategies/facebook'
|
11
11
|
autoload :GitHub, 'omniauth/strategies/github'
|
12
12
|
autoload :ThirtySevenSignals, 'omniauth/strategies/thirty_seven_signals'
|
13
|
+
autoload :Foursquare, 'omniauth/strategies/foursquare'
|
13
14
|
end
|
14
15
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module OmniAuth
|
2
|
+
module Strategies
|
3
|
+
class Foursquare < OAuth
|
4
|
+
def initialize(app, consumer_key, consumer_secret)
|
5
|
+
super(app, :foursquare, consumer_key, consumer_secret,
|
6
|
+
:site => 'http://foursquare.com')
|
7
|
+
end
|
8
|
+
|
9
|
+
def auth_hash
|
10
|
+
OmniAuth::Utils.deep_merge(super, {
|
11
|
+
'uid' => user_hash['id'],
|
12
|
+
'user_info' => user_info,
|
13
|
+
'extra' => {'user_hash' => user_hash}
|
14
|
+
})
|
15
|
+
end
|
16
|
+
|
17
|
+
def user_info
|
18
|
+
user_hash = self.user_hash
|
19
|
+
|
20
|
+
{
|
21
|
+
'nickname' => user_hash['twitter'],
|
22
|
+
'first_name' => user_hash['firstname'],
|
23
|
+
'last_name' => user_hash['lastname'],
|
24
|
+
'email' => user_hash['email'],
|
25
|
+
'name' => "#{user_hash['firstname']} #{user_hash['lastname']}".strip,
|
26
|
+
# 'location' => user_hash['location'],
|
27
|
+
'image' => user_hash['photo'],
|
28
|
+
# 'description' => user_hash['description'],
|
29
|
+
'phone' => user_hash['phone'],
|
30
|
+
'urls' => {}
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
def user_hash
|
35
|
+
@user_hash ||= MultiJson.decode(@access_token.get('http://api.foursquare.com/v1/user.json').body)['user']
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oa-oauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.5
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Bleigh
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-10-01 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -24,12 +24,12 @@ dependencies:
|
|
24
24
|
requirements:
|
25
25
|
- - "="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
hash:
|
27
|
+
hash: 27
|
28
28
|
segments:
|
29
29
|
- 0
|
30
|
+
- 1
|
30
31
|
- 0
|
31
|
-
|
32
|
-
version: 0.0.5
|
32
|
+
version: 0.1.0
|
33
33
|
requirement: *id001
|
34
34
|
name: oa-core
|
35
35
|
prerelease: false
|
@@ -203,6 +203,7 @@ extra_rdoc_files: []
|
|
203
203
|
files:
|
204
204
|
- lib/omniauth/oauth.rb
|
205
205
|
- lib/omniauth/strategies/facebook.rb
|
206
|
+
- lib/omniauth/strategies/foursquare.rb
|
206
207
|
- lib/omniauth/strategies/github.rb
|
207
208
|
- lib/omniauth/strategies/linked_in.rb
|
208
209
|
- lib/omniauth/strategies/oauth.rb
|