ldclip 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,6 +1,11 @@
1
+ == 0.0.2 2008-02-11
2
+
3
+ * utadaq
4
+ * bug(options[:tag] not worked) fix
5
+
1
6
  == 0.0.1 2008-02-09
2
7
 
3
8
  * utadaq
4
9
  * first release
5
10
 
6
- $Id: History.txt 6 2008-02-10 13:58:22Z utadaq $
11
+ $Id: History.txt 9 2008-02-11 04:44:09Z utadaq $
@@ -2,8 +2,9 @@ class Ldclip #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
9
9
  end
10
+ # $Id: version.rb 9 2008-02-11 04:44:09Z utadaq $
data/lib/ldclip.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # ruby interface of LivedoorClipAPI
4
4
  #
5
- # $Id: ldclip.rb 6 2008-02-10 13:58:22Z utadaq $
5
+ # $Id: ldclip.rb 9 2008-02-11 04:44:09Z utadaq $
6
6
 
7
7
  require 'net/https'
8
8
  require 'cgi'
@@ -32,10 +32,10 @@ class Ldclip
32
32
  # url
33
33
  def get(options = {})
34
34
  params = []
35
- params << "tag=#{options[:tag]}" if options[:tag]
35
+ params << "tag=#{CGI.escape(NKF.nkf('-w',options[:tag]))}" if options[:tag]
36
36
  params << "dt=#{options[:dt]}" if options[:dt]
37
37
  params << "url=#{options[:url]}" if options[:url]
38
- connect("posts/get?#{params.map{|e|CGI.escape(NKF.nkf('-w',e))}.join('&')}")
38
+ connect("posts/get?#{params.join('&')}")
39
39
  end
40
40
 
41
41
  #options
@@ -43,17 +43,17 @@ class Ldclip
43
43
  # count (default = 15,max = 100)
44
44
  def recent(options = {})
45
45
  params = []
46
- params << "tag=#{options[:tag]}" if options[:tag]
46
+ params << "tag=#{CGI.escape(NKF.nkf('-w',options[:tag]))}" if options[:tag]
47
47
  params << "count=#{options[:count]}" if options[:count]
48
- connect("posts/recent?#{params.map{|e|CGI.escape(NKF.nkf('-w',e))}.join('&')}")
48
+ connect("posts/recent?#{params.join('&')}")
49
49
  end
50
50
 
51
51
  #options
52
52
  # tag
53
53
  def all(options = {})
54
54
  params = ''
55
- params += "tag=#{options[:tag]}" if options[:tag]
56
- connect("posts/all?#{CGI.escape(NKF.nkf('-w',params))}")
55
+ params += "tag=#{CGI.escape(NKF.nkf('-w',options[:tag]))}" if options[:tag]
56
+ connect("posts/all?#{params}")
57
57
  end
58
58
 
59
59
 
data/test/test_ldclip.rb CHANGED
@@ -1,4 +1,4 @@
1
- # $Id: test_ldclip.rb 6 2008-02-10 13:58:22Z utadaq $
1
+ # $Id: test_ldclip.rb 9 2008-02-11 04:44:09Z utadaq $
2
2
  require File.dirname(__FILE__) + '/test_helper.rb'
3
3
  require 'cgi'
4
4
 
@@ -7,7 +7,9 @@ class TestLdclip < Test::Unit::TestCase
7
7
  def setup
8
8
  # get your apikey at ( need livedoor id )
9
9
  # http://clip.livedoor.com/config/api
10
- # @ldc = Ldclip.new('your account','your apikey')
10
+
11
+ # @ldc = Ldclip.new(@id,@apikey)
12
+ @ldc = Ldclip.new('your account','your apikey')
11
13
  assert_nil('get your apikey at ( need livedoor id )')
12
14
  exit
13
15
  end
@@ -35,15 +37,15 @@ class TestLdclip < Test::Unit::TestCase
35
37
  assert_match(/<post /,notempty)
36
38
 
37
39
  assert_not_nil(empty = @ldc.recent({:tag => 'dummy'}))
38
- ## assert_no_match(/<post /,empty)
40
+ assert_no_match(/<post /,empty)
39
41
  end
40
42
 
41
43
  def test_all
42
- # assert_not_nil(notempty = @ldc.all)
43
- # assert_match(/<post /,notempty)
44
+ assert_not_nil(notempty = @ldc.all)
45
+ assert_match(/<post /,notempty)
44
46
 
45
- # assert_not_nil(empty = @ldc.all({:tag => 'dummy'}))
46
- ## assert_no_match(/<post /,empty)
47
+ assert_not_nil(empty = @ldc.all({:tag => 'dummy'}))
48
+ assert_no_match(/<post /,empty)
47
49
  end
48
50
 
49
51
  def test_posts
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: ldclip
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.1
7
- date: 2008-02-10 00:00:00 +09:00
6
+ version: 0.0.2
7
+ date: 2008-02-11 00:00:00 +09:00
8
8
  summary: livedoor clip api for ruby
9
9
  require_paths:
10
10
  - lib