oa-oauth 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,5 +15,7 @@ module OmniAuth
15
15
  autoload :Identica, 'omniauth/strategies/identica'
16
16
  autoload :TripIt, 'omniauth/strategies/trip_it'
17
17
  autoload :Dopplr, 'omniauth/strategies/dopplr'
18
+ autoload :Meetup, 'omniauth/strategies/meetup'
19
+ autoload :SoundCloud, 'omniauth/strategies/sound_cloud'
18
20
  end
19
21
  end
@@ -0,0 +1,23 @@
1
+ require 'omniauth/oauth'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ #
7
+ # Authenticate to Meetup via OAuth and retrieve an access token for API usage
8
+ #
9
+ # Usage:
10
+ #
11
+ # use OmniAuth::Strategies::Meetup, 'consumerkey', 'consumersecret'
12
+ #
13
+ class Meetup < OmniAuth::Strategies::OAuth
14
+ def initialize(app, consumer_key, consumer_secret)
15
+ super(app, :meetup, consumer_key, consumer_secret,
16
+ # :site => 'https://api.meetup.com',
17
+ :request_token_path => "https://api.meetup.com/oauth/request",
18
+ :access_token_path => "https://api.meetup.com/oauth/access",
19
+ :authorize_path => "http://www.meetup.com/authorize/")
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,46 @@
1
+ require 'omniauth/oauth'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ #
7
+ # Authenticate to SoundCloud via OAuth and retrieve basic
8
+ # user information.
9
+ #
10
+ # Usage:
11
+ #
12
+ # use OmniAuth::Strategies::SoundCloud, 'consumerkey', 'consumersecret'
13
+ #
14
+
15
+ class SoundCloud < OmniAuth::Strategies::OAuth
16
+ def initialize(app, consumer_key, consumer_secret)
17
+ super(app, :soundcloud, consumer_key, consumer_secret, :site => 'https://api.soundcloud.com')
18
+ end
19
+
20
+ def auth_hash
21
+ OmniAuth::Utils.deep_merge(super, {
22
+ 'uid' => user_hash['id'],
23
+ 'user_info' => user_info,
24
+ 'extra' => {'user_hash' => user_hash}
25
+ })
26
+ end
27
+
28
+ def user_info
29
+ user_hash = self.user_hash
30
+
31
+ {
32
+ 'name' => user_hash['full_name'],
33
+ 'nickname' => user_hash['username'],
34
+ 'location' => user_hash['city'],
35
+ 'description' => user_hash['description'],
36
+ 'image' => user_hash['avatar_url'],
37
+ 'urls' => {'Website' => user_hash['website']}
38
+ }
39
+ end
40
+
41
+ def user_hash
42
+ @user_hash ||= MultiJson.decode(@access_token.get('/me.json').body)
43
+ end
44
+ end
45
+ end
46
+ end
@@ -28,8 +28,8 @@ module OmniAuth
28
28
  end
29
29
 
30
30
  def urlencode(str)
31
- str.gsub(/[^a-zA-Z0-9_\.\-]/n) {|s| sprintf('%%%02x', s[0]) }
32
- end
31
+ str.gsub(/[^a-zA-Z0-9_\.\-]/n) { sprintf('%%%02x', $&[0].ord) }
32
+ end
33
33
  end
34
34
  end
35
35
  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: 17
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 5
10
- version: 0.1.5
9
+ - 6
10
+ version: 0.1.6
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-10-19 00:00:00 -05:00
18
+ date: 2010-10-25 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: 17
27
+ hash: 23
28
28
  segments:
29
29
  - 0
30
30
  - 1
31
- - 5
32
- version: 0.1.5
31
+ - 6
32
+ version: 0.1.6
33
33
  requirement: *id001
34
34
  name: oa-core
35
35
  prerelease: false
@@ -88,12 +88,12 @@ dependencies:
88
88
  requirements:
89
89
  - - ~>
90
90
  - !ruby/object:Gem::Version
91
- hash: 11
91
+ hash: 27
92
92
  segments:
93
93
  - 0
94
+ - 1
94
95
  - 0
95
- - 10
96
- version: 0.0.10
96
+ version: 0.1.0
97
97
  requirement: *id005
98
98
  name: oauth2
99
99
  prerelease: false
@@ -206,12 +206,13 @@ files:
206
206
  - lib/omniauth/strategies/facebook.rb
207
207
  - lib/omniauth/strategies/foursquare.rb
208
208
  - lib/omniauth/strategies/github.rb
209
- - lib/omniauth/strategies/google_apps_market.rb
210
209
  - lib/omniauth/strategies/gowalla.rb
211
210
  - lib/omniauth/strategies/identica.rb
212
211
  - lib/omniauth/strategies/linked_in.rb
212
+ - lib/omniauth/strategies/meetup.rb
213
213
  - lib/omniauth/strategies/oauth.rb
214
214
  - lib/omniauth/strategies/oauth2.rb
215
+ - lib/omniauth/strategies/sound_cloud.rb
215
216
  - lib/omniauth/strategies/thirty_seven_signals.rb
216
217
  - lib/omniauth/strategies/trip_it.rb
217
218
  - lib/omniauth/strategies/twitter.rb
@@ -1,3 +0,0 @@
1
- module OmniAuth
2
- module Strategies
3
- class GoogleAppsMarket