omniauth-foursquare 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  require "omniauth-foursquare/version"
2
+ require "omniauth/strategies/foursquare"
2
3
 
3
4
  module Omniauth
4
5
  module Foursquare
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Foursquare
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -0,0 +1,43 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Foursquare < OmniAuth::Strategies::OAuth2
6
+ option :client_options, {
7
+ :site => 'https://foursquare.com',
8
+ :authorize_url => '/oauth2/authorize',
9
+ :token_url => '/oauth2/access_token'
10
+ }
11
+
12
+ def request_phase
13
+ options[:authorize_params] = client_params.merge(options[:authorize_params])
14
+ super
15
+ end
16
+
17
+ def auth_hash
18
+ OmniAuth::Utils.deep_merge(super, client_params.merge({
19
+ :grant_type => 'authorization_code'}))
20
+ end
21
+
22
+ info do
23
+ {
24
+ :first_name => raw_info['firstName'],
25
+ :last_name => raw_info['lastName']
26
+ }
27
+ end
28
+
29
+ def raw_info
30
+ access_token.options[:mode] = :query
31
+ access_token.options[:param_name] = :oauth_token
32
+ response = access_token.get('https://api.foursquare.com/v2/users/self').parsed['response']
33
+ @raw_info ||= response['user']
34
+ end
35
+
36
+ private
37
+
38
+ def client_params
39
+ {:client_id => options[:client_id], :redirect_uri => callback_url ,:response_type => "code"}
40
+ end
41
+ end
42
+ end
43
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-foursquare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-11-06 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth
16
- requirement: &70105830818500 !ruby/object:Gem::Requirement
16
+ requirement: &70357413319660 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70105830818500
24
+ version_requirements: *70357413319660
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: omniauth-oauth2
27
- requirement: &70105830817760 !ruby/object:Gem::Requirement
27
+ requirement: &70357413318920 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70105830817760
35
+ version_requirements: *70357413318920
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70105830817040 !ruby/object:Gem::Requirement
38
+ requirement: &70357413318400 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '2.7'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70105830817040
46
+ version_requirements: *70357413318400
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rack-test
49
- requirement: &70105830816480 !ruby/object:Gem::Requirement
49
+ requirement: &70357413317980 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70105830816480
57
+ version_requirements: *70357413317980
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: simplecov
60
- requirement: &70105830816020 !ruby/object:Gem::Requirement
60
+ requirement: &70357413316920 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70105830816020
68
+ version_requirements: *70357413316920
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
- requirement: &70105830815600 !ruby/object:Gem::Requirement
71
+ requirement: &70357413306680 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70105830815600
79
+ version_requirements: *70357413306680
80
80
  description: Foursquare OAuth strategy for OmniAuth
81
81
  email:
82
82
  - arunagw@gmail.com
@@ -89,6 +89,7 @@ files:
89
89
  - Rakefile
90
90
  - lib/omniauth-foursquare.rb
91
91
  - lib/omniauth-foursquare/version.rb
92
+ - lib/omniauth/strategies/foursquare.rb
92
93
  - omniauth-foursquare.gemspec
93
94
  homepage: https://github.com/arunagw/omniauth-foursquare
94
95
  licenses: []
@@ -104,7 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
105
  version: '0'
105
106
  segments:
106
107
  - 0
107
- hash: 621929573129871708
108
+ hash: -2644114744049422317
108
109
  required_rubygems_version: !ruby/object:Gem::Requirement
109
110
  none: false
110
111
  requirements:
@@ -113,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
114
  version: '0'
114
115
  segments:
115
116
  - 0
116
- hash: 621929573129871708
117
+ hash: -2644114744049422317
117
118
  requirements: []
118
119
  rubyforge_project: omniauth-foursquare
119
120
  rubygems_version: 1.8.6