livedoorauth 0.0.1 → 0.0.2

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.
@@ -1,3 +1,6 @@
1
+ +++ 0.0.2 2007-04-23
2
+ + bugfix: CGI.escape to all uri parameters
3
+
1
4
  +++ 0.0.1 2007-04-21
2
5
 
3
6
  + 1 major enhancement:
data/README.txt CHANGED
@@ -1,3 +1,32 @@
1
- README for livedoorauth
2
- ================
3
- read test/test_auth.rb
1
+ = Livedoor::API::Auth -- Livedoor Authentication API
2
+
3
+ == SYNOPSIS
4
+
5
+ require 'rubygems'
6
+ require 'livedoorauth'
7
+ auth = Livedoor::API::Auth.new(:app_key => YOUR_API_KEY, :secret => YOUR_SECRET_KEY)
8
+
9
+ # login_uri generate
10
+ auth.uri_to_login
11
+
12
+ # login check
13
+ user = auth.validate_response(uri.query)
14
+
15
+ # get livedoor id
16
+ id = auth.get_livedoor_id(user)
17
+
18
+
19
+ == NOTES
20
+ see test/test_auth.rb
21
+
22
+ == Installation
23
+
24
+ # gem install livedoorauth
25
+
26
+ == License
27
+
28
+ MIT
29
+
30
+ == Author
31
+
32
+ zoriorz@gmail.com
@@ -89,7 +89,7 @@ module Livedoor
89
89
  query[:t] = Time.now.to_i
90
90
  query[:v] = API_VERSION
91
91
  query[:sig] = sig(query)
92
- query.map {|i| i.join '=' }.join('&')
92
+ query.map {|k,v| "#{k}=#{CGI.escape(v.to_s)}"}.join('&')
93
93
  end
94
94
 
95
95
  def uri_to_auth_rpc(param)
@@ -4,7 +4,7 @@ module Livedoor #:nodoc:
4
4
  module VERSION #:nodoc:
5
5
  MAJOR = 0
6
6
  MINOR = 0
7
- TINY = 1
7
+ TINY = 2
8
8
 
9
9
  STRING = [MAJOR, MINOR, TINY].join('.')
10
10
  end
@@ -28,11 +28,13 @@ class TestLivedoorAuth < Test::Unit::TestCase
28
28
  #get auth info
29
29
  agent.redirect_ok = false
30
30
  auth = Livedoor::API::Auth.new(:app_key => APPKEY, :secret => SECRET)
31
- uri = auth.uri_to_login(:perms=>'id')
31
+ userdata = 'userdata'
32
+ uri = auth.uri_to_login(:perms=>'id', :userdata=>userdata)
32
33
  page = agent.get(uri.to_s)
33
34
  uri = URI.parse(page.response['location'])
34
35
  user = auth.validate_response(uri.query)
35
36
  assert_not_nil(user[:userhash])
37
+ assert_equal(userdata, user[:userdata])
36
38
 
37
39
  #get livedoor id
38
40
  id = auth.get_livedoor_id(user)
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: livedoorauth
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.1
7
- date: 2007-04-21 00:00:00 +09:00
6
+ version: 0.0.2
7
+ date: 2007-04-23 00:00:00 +09:00
8
8
  summary: livedoor auth api
9
9
  require_paths:
10
10
  - lib