oa-oauth 0.2.4 → 0.2.5

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.
Files changed (79) hide show
  1. data/lib/omniauth/oauth.rb +33 -24
  2. data/lib/omniauth/strategies/bitly.rb +4 -4
  3. data/lib/omniauth/strategies/doit.rb +8 -8
  4. data/lib/omniauth/strategies/dopplr.rb +6 -6
  5. data/lib/omniauth/strategies/douban.rb +60 -0
  6. data/lib/omniauth/strategies/evernote.rb +1 -6
  7. data/lib/omniauth/strategies/facebook.rb +5 -5
  8. data/lib/omniauth/strategies/foursquare.rb +12 -7
  9. data/lib/omniauth/strategies/github.rb +6 -6
  10. data/lib/omniauth/strategies/goodreads.rb +3 -3
  11. data/lib/omniauth/strategies/gowalla.rb +6 -6
  12. data/lib/omniauth/strategies/hyves.rb +14 -14
  13. data/lib/omniauth/strategies/instagram.rb +7 -7
  14. data/lib/omniauth/strategies/instapaper.rb +6 -6
  15. data/lib/omniauth/strategies/linked_in.rb +9 -9
  16. data/lib/omniauth/strategies/miso.rb +5 -5
  17. data/lib/omniauth/strategies/mixi.rb +8 -8
  18. data/lib/omniauth/strategies/oauth2.rb +21 -22
  19. data/lib/omniauth/strategies/qzone.rb +69 -0
  20. data/lib/omniauth/strategies/rdio.rb +45 -0
  21. data/lib/omniauth/strategies/renren.rb +87 -0
  22. data/lib/omniauth/strategies/salesforce.rb +1 -1
  23. data/lib/omniauth/strategies/smug_mug.rb +4 -4
  24. data/lib/omniauth/strategies/sound_cloud.rb +7 -7
  25. data/lib/omniauth/strategies/t163.rb +57 -0
  26. data/lib/omniauth/strategies/thirty_seven_signals.rb +5 -5
  27. data/lib/omniauth/strategies/tqq.rb +64 -0
  28. data/lib/omniauth/strategies/trade_me.rb +4 -4
  29. data/lib/omniauth/strategies/tsina.rb +79 -0
  30. data/lib/omniauth/strategies/tsohu.rb +57 -0
  31. data/lib/omniauth/strategies/twitter.rb +7 -7
  32. data/lib/omniauth/strategies/type_pad.rb +6 -6
  33. data/lib/omniauth/strategies/vkontakte.rb +1 -1
  34. data/lib/omniauth/strategies/xauth.rb +9 -9
  35. data/lib/omniauth/strategies/yahoo.rb +4 -4
  36. data/lib/omniauth/strategies/yammer.rb +43 -0
  37. data/lib/omniauth/version.rb +19 -0
  38. data/oa-oauth.gemspec +13 -10
  39. data/spec/omniauth/strategies/bitly_spec.rb +1 -1
  40. data/spec/omniauth/strategies/dailymile_spec.rb +1 -1
  41. data/spec/omniauth/strategies/doit_spec.rb +2 -2
  42. data/spec/omniauth/strategies/dopplr_spec.rb +1 -1
  43. data/spec/omniauth/strategies/douban_spec.rb +5 -0
  44. data/spec/omniauth/strategies/evernote_spec.rb +3 -5
  45. data/spec/omniauth/strategies/facebook_spec.rb +2 -2
  46. data/spec/omniauth/strategies/foursquare_spec.rb +15 -1
  47. data/spec/omniauth/strategies/github_spec.rb +1 -1
  48. data/spec/omniauth/strategies/goodreads_spec.rb +1 -1
  49. data/spec/omniauth/strategies/google_spec.rb +1 -1
  50. data/spec/omniauth/strategies/gowalla_spec.rb +3 -3
  51. data/spec/omniauth/strategies/hyves_spec.rb +2 -2
  52. data/spec/omniauth/strategies/identica_spec.rb +1 -1
  53. data/spec/omniauth/strategies/linked_in_spec.rb +1 -1
  54. data/spec/omniauth/strategies/meetup_spec.rb +1 -1
  55. data/spec/omniauth/strategies/miso_spec.rb +2 -2
  56. data/spec/omniauth/strategies/netflix_spec.rb +1 -1
  57. data/spec/omniauth/strategies/oauth_spec.rb +1 -1
  58. data/spec/omniauth/strategies/rdio_spec.rb +5 -0
  59. data/spec/omniauth/strategies/salesforce_spec.rb +1 -1
  60. data/spec/omniauth/strategies/smug_mug_spec.rb +3 -3
  61. data/spec/omniauth/strategies/sound_cloud_spec.rb +2 -2
  62. data/spec/omniauth/strategies/t163_spec.rb +5 -0
  63. data/spec/omniauth/strategies/teambox_spec.rb +1 -1
  64. data/spec/omniauth/strategies/thirty_seven_signals_spec.rb +2 -2
  65. data/spec/omniauth/strategies/trade_me_spec.rb +2 -2
  66. data/spec/omniauth/strategies/trip_it_spec.rb +1 -1
  67. data/spec/omniauth/strategies/tsina_spec.rb +5 -0
  68. data/spec/omniauth/strategies/tumblr_spec.rb +2 -2
  69. data/spec/omniauth/strategies/twitter_spec.rb +4 -4
  70. data/spec/omniauth/strategies/type_pad_spec.rb +1 -1
  71. data/spec/omniauth/strategies/vimeo_spec.rb +2 -2
  72. data/spec/omniauth/strategies/vkontakte_spec.rb +1 -1
  73. data/spec/omniauth/strategies/yahoo_spec.rb +1 -1
  74. data/spec/omniauth/strategies/yammer_spec.rb +5 -0
  75. data/spec/omniauth/strategies/you_tube_spec.rb +1 -1
  76. data/spec/spec_helper.rb +4 -9
  77. data/spec/support/shared_examples.rb +3 -3
  78. metadata +77 -25
  79. data/Gemfile +0 -3
@@ -6,39 +6,48 @@ module OmniAuth
6
6
  autoload :OAuth2, 'omniauth/strategies/oauth2'
7
7
  autoload :XAuth, 'omniauth/strategies/xauth'
8
8
 
9
- autoload :Twitter, 'omniauth/strategies/twitter'
10
- autoload :LinkedIn, 'omniauth/strategies/linked_in'
9
+ autoload :Bitly, 'omniauth/strategies/bitly'
10
+ autoload :Dailymile, 'omniauth/strategies/dailymile'
11
+ autoload :Doit, 'omniauth/strategies/doit'
12
+ autoload :Dopplr, 'omniauth/strategies/dopplr'
13
+ autoload :Douban, 'omniauth/strategies/douban'
14
+ autoload :Evernote, 'omniauth/strategies/evernote'
11
15
  autoload :Facebook, 'omniauth/strategies/facebook'
12
- autoload :GitHub, 'omniauth/strategies/github'
13
- autoload :ThirtySevenSignals, 'omniauth/strategies/thirty_seven_signals'
14
16
  autoload :Foursquare, 'omniauth/strategies/foursquare'
15
- autoload :Gowalla, 'omniauth/strategies/gowalla'
16
- autoload :Identica, 'omniauth/strategies/identica'
17
- autoload :TripIt, 'omniauth/strategies/trip_it'
18
- autoload :Dopplr, 'omniauth/strategies/dopplr'
19
- autoload :Meetup, 'omniauth/strategies/meetup'
20
- autoload :Salesforce, 'omniauth/strategies/salesforce'
21
- autoload :SoundCloud, 'omniauth/strategies/sound_cloud'
22
- autoload :SmugMug, 'omniauth/strategies/smug_mug'
17
+ autoload :GitHub, 'omniauth/strategies/github'
23
18
  autoload :Goodreads, 'omniauth/strategies/goodreads'
24
- autoload :Yahoo, 'omniauth/strategies/yahoo'
25
- autoload :TypePad, 'omniauth/strategies/type_pad'
26
19
  autoload :Google, 'omniauth/strategies/google'
27
- autoload :Netflix, 'omniauth/strategies/netflix'
28
- autoload :Bitly, 'omniauth/strategies/bitly'
29
- autoload :Vimeo, 'omniauth/strategies/vimeo'
30
- autoload :YouTube, 'omniauth/strategies/you_tube'
20
+ autoload :Gowalla, 'omniauth/strategies/gowalla'
31
21
  autoload :Hyves, 'omniauth/strategies/hyves'
32
- autoload :Miso, 'omniauth/strategies/miso'
33
- autoload :Dailymile, 'omniauth/strategies/dailymile'
22
+ autoload :Identica, 'omniauth/strategies/identica'
34
23
  autoload :Instagram, 'omniauth/strategies/instagram'
35
- autoload :Mixi, 'omniauth/strategies/mixi'
36
- autoload :Evernote, 'omniauth/strategies/evernote'
37
- autoload :Doit, 'omniauth/strategies/doit'
38
24
  autoload :Instapaper, 'omniauth/strategies/instapaper'
39
- autoload :TradeMe, 'omniauth/strategies/trade_me'
25
+ autoload :LinkedIn, 'omniauth/strategies/linked_in'
26
+ autoload :Meetup, 'omniauth/strategies/meetup'
27
+ autoload :Miso, 'omniauth/strategies/miso'
28
+ autoload :Mixi, 'omniauth/strategies/mixi'
29
+ autoload :Netflix, 'omniauth/strategies/netflix'
30
+ autoload :Qzone, 'omniauth/strategies/qzone'
31
+ autoload :Rdio, 'omniauth/strategies/rdio'
32
+ autoload :Renren, 'omniauth/strategies/renren'
33
+ autoload :Salesforce, 'omniauth/strategies/salesforce'
34
+ autoload :SmugMug, 'omniauth/strategies/smug_mug'
35
+ autoload :SoundCloud, 'omniauth/strategies/sound_cloud'
36
+ autoload :T163, 'omniauth/strategies/t163'
40
37
  autoload :Teambox, 'omniauth/strategies/teambox'
38
+ autoload :ThirtySevenSignals, 'omniauth/strategies/thirty_seven_signals'
39
+ autoload :Tqq, 'omniauth/strategies/tqq'
40
+ autoload :TradeMe, 'omniauth/strategies/trade_me'
41
+ autoload :TripIt, 'omniauth/strategies/trip_it'
42
+ autoload :Tsina, 'omniauth/strategies/tsina'
43
+ autoload :Tsohu, 'omniauth/strategies/tsohu'
41
44
  autoload :Tumblr, 'omniauth/strategies/tumblr'
45
+ autoload :Twitter, 'omniauth/strategies/twitter'
46
+ autoload :TypePad, 'omniauth/strategies/type_pad'
47
+ autoload :Vimeo, 'omniauth/strategies/vimeo'
42
48
  autoload :Vkontakte, 'omniauth/strategies/vkontakte'
49
+ autoload :Yahoo, 'omniauth/strategies/yahoo'
50
+ autoload :Yammer, 'omniauth/strategies/yammer'
51
+ autoload :YouTube, 'omniauth/strategies/you_tube'
43
52
  end
44
53
  end
@@ -22,16 +22,16 @@ module OmniAuth
22
22
 
23
23
  super(app, :bitly, api_key, secret_key, client_options, options, &block)
24
24
  end
25
-
25
+
26
26
  protected
27
-
27
+
28
28
  def user_data
29
29
  {
30
30
  'login' => @access_token['login'],
31
31
  'api_key' => @access_token['apiKey']
32
32
  }
33
33
  end
34
-
34
+
35
35
  def auth_hash
36
36
  OmniAuth::Utils.deep_merge(super, {
37
37
  'uid' => @access_token['login'],
@@ -43,4 +43,4 @@ module OmniAuth
43
43
 
44
44
  end
45
45
 
46
- end
46
+ end
@@ -10,26 +10,26 @@ module OmniAuth
10
10
  :authorize_url => 'https://openapi.doit.im/oauth/authorize',
11
11
  :access_token_url => 'https://openapi.doit.im/oauth/access_token'
12
12
  }
13
-
13
+
14
14
  super(app, :doit, consumer_key, consumer_secret, client_options, options, &block)
15
15
  end
16
-
16
+
17
17
  protected
18
-
18
+
19
19
  def user_data
20
20
  @data ||= MultiJson.decode(@access_token.get(client.site+"/v1/settings"),{'Authorization'=> 'OAuth'+@access_token.token})
21
21
  end
22
-
22
+
23
23
  def request_phase
24
24
  options[:response_type] ||= "code"
25
25
  super
26
26
  end
27
-
27
+
28
28
  def callback_phase
29
29
  options[:grant_type] ||= 'authorization_code'
30
30
  super
31
31
  end
32
-
32
+
33
33
  def user_info
34
34
  {
35
35
  'account' => user_data['account'],
@@ -47,7 +47,7 @@ module OmniAuth
47
47
  'updated'=> user_data['updated']
48
48
  }
49
49
  end
50
-
50
+
51
51
  def auth_hash
52
52
  OmniAuth::Utils.deep_merge(super, {
53
53
  'uid' => user_data['id'],
@@ -57,4 +57,4 @@ module OmniAuth
57
57
  end
58
58
  end
59
59
  end
60
- end
60
+ end
@@ -21,14 +21,14 @@ module OmniAuth
21
21
  :access_token_path => "/oauth/access_token",
22
22
  :authorize_path => "/oauth/authorize"
23
23
  }
24
-
24
+
25
25
  super(app, :dopplr, consumer_key, consumer_secret, client_options, options, &block)
26
- end
27
-
26
+ end
27
+
28
28
  def user_data
29
29
  @data ||= MultiJson.decode(@access_token.get('/oauthapi/whoami').body)['whoami']
30
30
  end
31
-
31
+
32
32
  def user_info
33
33
  {
34
34
  'nickname' => user_data["nick"],
@@ -40,14 +40,14 @@ module OmniAuth
40
40
  'DopplrMobile' => user_data["mobile_url"],
41
41
  }
42
42
  }
43
- end
43
+ end
44
44
 
45
45
  def auth_hash
46
46
  OmniAuth::Utils.deep_merge(super, {
47
47
  'uid' => user_data['nick'],
48
48
  'user_info' => user_info
49
49
  })
50
- end
50
+ end
51
51
  end
52
52
  end
53
53
  end
@@ -0,0 +1,60 @@
1
+ require 'omniauth/oauth'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ #
7
+ # Authenticate to Douban via OAuth and retrieve basic
8
+ # user information.
9
+ #
10
+ # Usage:
11
+ #
12
+ # use OmniAuth::Strategies::Douban, 'APIKey', 'APIKeySecret'
13
+ #
14
+ class Douban < OmniAuth::Strategies::OAuth
15
+ def initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block)
16
+ # Although in OAuth spec the :realm parameter is optional,
17
+ # it is required for Douban.
18
+ client_options = {
19
+ :site => 'http://www.douban.com',
20
+ :request_token_path => '/service/auth/request_token',
21
+ :access_token_path => '/service/auth/access_token',
22
+ :authorize_path => '/service/auth/authorize',
23
+ :realm => 'OmniAuth'
24
+ }
25
+
26
+ super(app, :douban, consumer_key, consumer_secret, client_options, options, &block)
27
+ end
28
+
29
+ def auth_hash
30
+ OmniAuth::Utils.deep_merge(super, {
31
+ 'uid' => @access_token.params[:douban_user_id],
32
+ 'user_info' => user_info,
33
+ 'extra' => {'user_hash' => user_hash}
34
+ })
35
+ end
36
+
37
+ def user_info
38
+ user_hash = self.user_hash
39
+
40
+ location = user_hash['location'] ? user_hash['location']['$t'] : nil
41
+ image = user_hash['link'].find {|l| l['@rel'] == 'icon' }['@href']
42
+ douban_url = user_hash['link'].find {|l| l['@rel'] == 'alternate' }['@href']
43
+ {
44
+ 'username' => user_hash['db:uid']['$t'],
45
+ 'name' => user_hash['title']['$t'],
46
+ 'location' => location,
47
+ 'image' => image,
48
+ 'description' => user_hash['content']['$t'],
49
+ 'urls' => {
50
+ 'Douban' => douban_url
51
+ }
52
+ }
53
+ end
54
+
55
+ def user_hash
56
+ @user_hash ||= MultiJson.decode(@access_token.get('http://api.douban.com/people/%40me?alt=json').body)
57
+ end
58
+ end
59
+ end
60
+ end
@@ -1,11 +1,6 @@
1
1
  require 'omniauth/oauth'
2
2
  require 'multi_json'
3
-
4
- begin
5
- require 'evernote'
6
- rescue LoadError => e
7
- raise "Omniauth Evernote strategy requires 'evernote' gem. Add it to your Gemfile: gem 'evernote'"
8
- end
3
+ require 'evernote'
9
4
 
10
5
  module OmniAuth
11
6
  module Strategies
@@ -16,16 +16,16 @@ module OmniAuth
16
16
  def initialize(app, client_id = nil, client_secret = nil, options = {}, &block)
17
17
  super(app, :facebook, client_id, client_secret, {:site => 'https://graph.facebook.com/'}, options, &block)
18
18
  end
19
-
19
+
20
20
  def user_data
21
21
  @data ||= MultiJson.decode(@access_token.get('/me', {}, { "Accept-Language" => "en-us,en;"}))
22
22
  end
23
-
23
+
24
24
  def request_phase
25
25
  options[:scope] ||= "email,offline_access"
26
26
  super
27
27
  end
28
-
28
+
29
29
  def build_access_token
30
30
  if facebook_session.nil? || facebook_session.empty?
31
31
  super
@@ -41,7 +41,7 @@ module OmniAuth
41
41
  else
42
42
  nil
43
43
  end
44
- end
44
+ end
45
45
 
46
46
  def user_info
47
47
  {
@@ -57,7 +57,7 @@ module OmniAuth
57
57
  }
58
58
  }
59
59
  end
60
-
60
+
61
61
  def auth_hash
62
62
  OmniAuth::Utils.deep_merge(super, {
63
63
  'uid' => user_data['id'],
@@ -9,33 +9,38 @@ module OmniAuth
9
9
  # @option options [Boolean, true] :sign_in When true, use a sign-in flow instead of the authorization flow.
10
10
  # @option options [Boolean, false] :mobile When true, use the mobile sign-in interface.
11
11
  def initialize(app, client_id = nil, client_secret = nil, options = {}, &block)
12
+ options[:sign_in] ||= true
12
13
  super(app, :foursquare, client_id, client_secret, {
13
14
  :site => "https://api.foursquare.com/v2",
14
- :authorize_url => "https://foursquare.com/oauth2/authenticate",
15
+ :authorize_url => authorize_url(options),
15
16
  :access_token_url => "https://foursquare.com/oauth2/access_token"
16
17
  }, options, &block)
17
18
  end
18
-
19
+
20
+ def authorize_url(options)
21
+ "https://foursquare.com/#{'mobile/' if options[:mobile]}oauth2/#{options[:sign_in] ? 'authenticate' : 'authorize'}"
22
+ end
23
+
19
24
  def user_data
20
25
  @data ||= MultiJson.decode(@access_token.get(client.site+'/users/self', {'oauth_token' => @access_token.token}))
21
26
  end
22
-
27
+
23
28
  def request_phase
24
29
  options[:response_type] ||= 'code'
25
30
  super
26
31
  end
27
-
32
+
28
33
  def callback_phase
29
34
  options[:grant_type] ||= 'authorization_code'
30
35
  super
31
36
  end
32
-
37
+
33
38
  def user_info
34
39
  {
35
40
  'nickname' => user_data['response']['user']['contact']['twitter'],
36
41
  'first_name' => user_data['response']['user']['firstName'],
37
42
  'last_name' => user_data['response']['user']['lastName'],
38
- 'email' => user_data['response']['user']['contact']['twitter'],
43
+ 'email' => user_data['response']['user']['contact']['email'],
39
44
  'name' => "#{user_data['response']['user']['firstName']} #{user_data['response']['user']['lastName']}".strip,
40
45
  # 'location' => user_data['response']['user']['location'],
41
46
  'image' => user_data['response']['user']['photo'],
@@ -44,7 +49,7 @@ module OmniAuth
44
49
  'urls' => {}
45
50
  }
46
51
  end
47
-
52
+
48
53
  def auth_hash
49
54
  OmniAuth::Utils.deep_merge(super, {
50
55
  'uid' => user_data['response']['user']['id'],
@@ -3,7 +3,7 @@ require 'multi_json'
3
3
 
4
4
  module OmniAuth
5
5
  module Strategies
6
- # OAuth 2.0 based authentication with GitHub. In order to
6
+ # OAuth 2.0 based authentication with GitHub. In order to
7
7
  # sign up for an application, you need to [register an application](http://github.com/account/applications/new)
8
8
  # and provide the proper credentials to this middleware.
9
9
  class GitHub < OAuth2
@@ -16,16 +16,16 @@ module OmniAuth
16
16
  :authorize_path => '/login/oauth/authorize',
17
17
  :access_token_path => '/login/oauth/access_token'
18
18
  }
19
-
19
+
20
20
  super(app, :github, client_id, client_secret, client_options, options, &block)
21
21
  end
22
-
22
+
23
23
  protected
24
-
24
+
25
25
  def user_data
26
26
  @data ||= MultiJson.decode(@access_token.get('/api/v2/json/user/show'))['user']
27
27
  end
28
-
28
+
29
29
  def user_info
30
30
  {
31
31
  'nickname' => user_data["login"],
@@ -37,7 +37,7 @@ module OmniAuth
37
37
  }
38
38
  }
39
39
  end
40
-
40
+
41
41
  def auth_hash
42
42
  OmniAuth::Utils.deep_merge(super, {
43
43
  'uid' => user_data['id'],
@@ -1,4 +1,4 @@
1
- require 'nokogiri'
1
+ require 'multi_xml'
2
2
  require 'omniauth/oauth'
3
3
 
4
4
  module OmniAuth
@@ -23,9 +23,9 @@ module OmniAuth
23
23
  end
24
24
 
25
25
  def user_hash(access_token)
26
- authenticated_user = Nokogiri::XML::Document.parse(@access_token.get('/api/auth_user').body)
26
+ authenticated_user = MultiXml.parse(@access_token.get('/api/auth_user').body)
27
27
  id = authenticated_user.xpath('GoodreadsResponse/user').attribute('id').value.to_i
28
- response_doc = Nokogiri::XML::Document.parse(open("http://www.goodreads.com/user/show/#{id}.xml?key=#{@consumer_key}").read)
28
+ response_doc = MultiXml.parse(open("http://www.goodreads.com/user/show/#{id}.xml?key=#{@consumer_key}").read)
29
29
  user = response_doc.xpath('GoodreadsResponse/user')
30
30
 
31
31
  hash = {
@@ -20,21 +20,21 @@ module OmniAuth
20
20
  :authorize_url => 'https://gowalla.com/api/oauth/new',
21
21
  :access_token_url => 'https://api.gowalla.com/api/oauth/token'
22
22
  }
23
-
23
+
24
24
  super(app, :gowalla, api_key, secret_key, client_options, options, &block)
25
25
  end
26
-
26
+
27
27
  protected
28
-
28
+
29
29
  def user_data
30
30
  @data ||= MultiJson.decode(@access_token.get("/users/me.json"))
31
31
  end
32
-
32
+
33
33
  def request_phase
34
34
  options[:scope] ||= "read"
35
35
  super
36
36
  end
37
-
37
+
38
38
  def user_info
39
39
  {
40
40
  'name' => "#{user_data['first_name']} #{user_data['last_name']}",
@@ -51,7 +51,7 @@ module OmniAuth
51
51
  }
52
52
  }
53
53
  end
54
-
54
+
55
55
  def auth_hash
56
56
  OmniAuth::Utils.deep_merge(super, {
57
57
  'uid' => user_data["url"].split('/').last,
@@ -15,10 +15,10 @@ module OmniAuth
15
15
  }
16
16
  super(app, :hyves, consumer_key, consumer_secret, client_options, options, &block)
17
17
  end
18
-
18
+
19
19
  def auth_hash
20
- hash = user_hash(@access_token)
21
-
20
+ hash = user_hash(@access_token)
21
+
22
22
  {
23
23
  "provider" => "hyves",
24
24
  "uid" => hash["userid"],
@@ -33,35 +33,35 @@ module OmniAuth
33
33
  }
34
34
  }
35
35
  end
36
-
36
+
37
37
  def user_hash(access_token)
38
38
  rsp = MultiJson.decode( access_token.get("http://data.hyves-api.nl/?userid=#{access_token.params[:userid]}&ha_method=users.get&#{default_options}").body )
39
39
  rsp["user"].first
40
40
  end
41
-
41
+
42
42
  def request_token_path
43
43
  "http://data.hyves-api.nl/?#{request_token_options}&#{default_options}"
44
44
  end
45
-
45
+
46
46
  def access_token_path
47
47
  "http://data.hyves-api.nl/?#{access_token_options}&#{default_options}"
48
48
  end
49
-
49
+
50
50
  def default_options
51
- to_params( { :ha_version => "2.0", :ha_format => "json", :ha_fancylayout => false } )
51
+ to_params( { :ha_version => "2.0", :ha_format => "json", :ha_fancylayout => false } )
52
52
  end
53
-
53
+
54
54
  def request_token_options
55
- to_params( { :methods => "users.get,friends.get,wwws.create", :ha_method => "auth.requesttoken", :strict_oauth_spec_response => true } )
55
+ to_params( { :methods => "users.get,friends.get,wwws.create", :ha_method => "auth.requesttoken", :strict_oauth_spec_response => true } )
56
56
  end
57
-
57
+
58
58
  def access_token_options
59
59
  to_params( { :ha_method => "auth.accesstoken", :strict_oauth_spec_response => true } )
60
60
  end
61
-
61
+
62
62
  def to_params(options)
63
63
  options.collect { |key, value| "#{key}=#{value}"}.join('&')
64
- end
64
+ end
65
65
  end
66
66
  end
67
- end
67
+ end