ldclip 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.
- data/History.txt +6 -1
- data/lib/ldclip/version.rb +2 -1
- data/lib/ldclip.rb +7 -7
- data/test/test_ldclip.rb +9 -7
- metadata +2 -2
data/History.txt
CHANGED
data/lib/ldclip/version.rb
CHANGED
data/lib/ldclip.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# ruby interface of LivedoorClipAPI
|
4
4
|
#
|
5
|
-
# $Id: ldclip.rb
|
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.
|
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]}"
|
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.
|
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]}"
|
56
|
-
connect("posts/all?#{
|
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
|
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
|
-
|
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
|
-
|
40
|
+
assert_no_match(/<post /,empty)
|
39
41
|
end
|
40
42
|
|
41
43
|
def test_all
|
42
|
-
|
43
|
-
|
44
|
+
assert_not_nil(notempty = @ldc.all)
|
45
|
+
assert_match(/<post /,notempty)
|
44
46
|
|
45
|
-
|
46
|
-
|
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.
|
7
|
-
date: 2008-02-
|
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
|