crown 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +4 -0
- data/README.rdoc +14 -11
- data/VERSION +1 -1
- data/crown.gemspec +15 -5
- data/example/entrylist.rb +69 -0
- data/example/fbcount.rb +1 -1
- data/example/hbentry.rb +1 -1
- data/example/rtcount.rb +1 -0
- data/example/twcount.rb +1 -1
- data/example/{annual.rb → urilist.rb} +21 -26
- data/lib/crown.rb +1 -1
- data/{example/hbtrace.rb → lib/crown/amazon.rb} +8 -23
- data/lib/crown/amazon/crawler.rb +159 -0
- data/lib/crown/amazon/ecs.rb +385 -0
- data/lib/crown/amazon/entrylist.rb +171 -0
- data/lib/crown/backtype.rb +2 -2
- data/lib/crown/buzzurl.rb +2 -2
- data/lib/crown/cgm.rb +8 -0
- data/lib/crown/cgm/countable.rb +1 -1
- data/lib/crown/cgm/summarizable.rb +1 -1
- data/lib/crown/delicious.rb +2 -2
- data/lib/crown/facebook.rb +4 -4
- data/lib/crown/facebook/entry.rb +5 -3
- data/lib/crown/google.rb +38 -0
- data/lib/crown/google/plusone.rb +65 -0
- data/lib/crown/google/plusone/counter.rb +102 -0
- data/lib/crown/hatena/bookmark.rb +7 -7
- data/lib/crown/hatena/bookmark/entry.rb +70 -68
- data/lib/crown/hatena/bookmark/entrylist.rb +98 -0
- data/lib/crown/hatena/bookmark/urilist.rb +349 -0
- data/lib/crown/http-wrapper.rb +0 -1
- data/lib/crown/linkedin.rb +60 -0
- data/lib/crown/linkedin/counter.rb +81 -0
- data/lib/crown/livedoor/clip.rb +2 -2
- data/lib/crown/livedoor/clip/counter.rb +1 -1
- data/lib/crown/livedoor/reader.rb +2 -2
- data/lib/crown/topsy.rb +2 -3
- data/lib/crown/tweetmeme.rb +2 -2
- data/lib/crown/twitter.rb +1 -1
- data/lib/crown/twitter/uri.rb +2 -2
- data/lib/crown/twitter/user.rb +4 -4
- data/lib/crown/twitter/user/entry.rb +26 -6
- data/lib/crown/yahoo/bookmark.rb +3 -7
- data/test/crown-test.rb +34 -12
- metadata +17 -7
- data/lib/crown/hatena/bookmark/linktrace.rb +0 -135
@@ -0,0 +1,60 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# --------------------------------------------------------------------------- #
|
3
|
+
#
|
4
|
+
# linkedin.rb
|
5
|
+
#
|
6
|
+
# Copyright (c) 2008 - 2012, clown.
|
7
|
+
#
|
8
|
+
# Redistribution and use in source and binary forms, with or without
|
9
|
+
# modification, are permitted provided that the following conditions
|
10
|
+
# are met:
|
11
|
+
#
|
12
|
+
# - Redistributions of source code must retain the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer.
|
14
|
+
# - Redistributions in binary form must reproduce the above copyright
|
15
|
+
# notice, this list of conditions and the following disclaimer in the
|
16
|
+
# documentation and/or other materials provided with the distribution.
|
17
|
+
# - No names of its contributors may be used to endorse or promote
|
18
|
+
# products derived from this software without specific prior written
|
19
|
+
# permission.
|
20
|
+
#
|
21
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
22
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
23
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
24
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
25
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
26
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
27
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
28
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
29
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
30
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
31
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
+
#
|
33
|
+
# --------------------------------------------------------------------------- #
|
34
|
+
module Crown
|
35
|
+
class LinkedIn
|
36
|
+
require 'crown/linkedin/counter'
|
37
|
+
|
38
|
+
# ------------------------------------------------------------------- #
|
39
|
+
#
|
40
|
+
# LinkedIn.count
|
41
|
+
#
|
42
|
+
# LinkedIn の API を介して,指定した URL へのシェア数を取得する.
|
43
|
+
#
|
44
|
+
# ------------------------------------------------------------------- #
|
45
|
+
def LinkedIn.count(uri, options = {})
|
46
|
+
return Crown::LinkedIn::URICounter.new.count(uri, options)
|
47
|
+
end
|
48
|
+
|
49
|
+
# ------------------------------------------------------------------- #
|
50
|
+
#
|
51
|
+
# count
|
52
|
+
#
|
53
|
+
# LinkedIn の API を介して,指定した URL へのシェア数を取得する.
|
54
|
+
#
|
55
|
+
# ------------------------------------------------------------------- #
|
56
|
+
def count(uri, options = {})
|
57
|
+
return Crown::LinkedIn::URICounter.new.count(uri, options)
|
58
|
+
end
|
59
|
+
end # LinkedIn
|
60
|
+
end # Crown
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# --------------------------------------------------------------------------- #
|
3
|
+
#
|
4
|
+
# linkedin/counter.rb
|
5
|
+
#
|
6
|
+
# Copyright (c) 2008 - 2012, clown.
|
7
|
+
#
|
8
|
+
# Redistribution and use in source and binary forms, with or without
|
9
|
+
# modification, are permitted provided that the following conditions
|
10
|
+
# are met:
|
11
|
+
#
|
12
|
+
# - Redistributions of source code must retain the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer.
|
14
|
+
# - Redistributions in binary form must reproduce the above copyright
|
15
|
+
# notice, this list of conditions and the following disclaimer in the
|
16
|
+
# documentation and/or other materials provided with the distribution.
|
17
|
+
# - No names of its contributors may be used to endorse or promote
|
18
|
+
# products derived from this software without specific prior written
|
19
|
+
# permission.
|
20
|
+
#
|
21
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
22
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
23
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
24
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
25
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
26
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
27
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
28
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
29
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
30
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
31
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
+
#
|
33
|
+
# --------------------------------------------------------------------------- #
|
34
|
+
module Crown
|
35
|
+
class LinkedIn
|
36
|
+
class URICounter
|
37
|
+
require 'cgi'
|
38
|
+
require 'crown/cgm/countable'
|
39
|
+
require 'rubygems'
|
40
|
+
require 'json'
|
41
|
+
|
42
|
+
# ------------------------------------------------------------------- #
|
43
|
+
# Mix-in modules
|
44
|
+
# ------------------------------------------------------------------- #
|
45
|
+
include Crown::CGM::Countable
|
46
|
+
|
47
|
+
private
|
48
|
+
# --------------------------------------------------------------- #
|
49
|
+
# address
|
50
|
+
# --------------------------------------------------------------- #
|
51
|
+
def address()
|
52
|
+
return 'www.linkedin.com'
|
53
|
+
end
|
54
|
+
|
55
|
+
# --------------------------------------------------------------- #
|
56
|
+
# path
|
57
|
+
# --------------------------------------------------------------- #
|
58
|
+
def path()
|
59
|
+
return '/cws/share-count'
|
60
|
+
end
|
61
|
+
|
62
|
+
# --------------------------------------------------------------- #
|
63
|
+
# query
|
64
|
+
# --------------------------------------------------------------- #
|
65
|
+
def query(uri, options)
|
66
|
+
return '?url=' + CGI.escape(uri)
|
67
|
+
end
|
68
|
+
|
69
|
+
# --------------------------------------------------------------- #
|
70
|
+
# parse
|
71
|
+
# --------------------------------------------------------------- #
|
72
|
+
def parse(body)
|
73
|
+
body.scan(/\{.+\}/) { |s|
|
74
|
+
json = JSON.parse(s)
|
75
|
+
return json["count"].to_i
|
76
|
+
}
|
77
|
+
return error_value()
|
78
|
+
end
|
79
|
+
end # URICounter
|
80
|
+
end # LinkedIn
|
81
|
+
end # Crown
|
data/lib/crown/livedoor/clip.rb
CHANGED
@@ -43,7 +43,7 @@ module Crown
|
|
43
43
|
# 指定した URL のクリップ数(ブックマーク数)を取得する.
|
44
44
|
#
|
45
45
|
# --------------------------------------------------------------- #
|
46
|
-
def Clip.count(uri, options =
|
46
|
+
def Clip.count(uri, options = {})
|
47
47
|
return Crown::Livedoor::ClipCounter.new.count(uri, options)
|
48
48
|
end
|
49
49
|
|
@@ -54,7 +54,7 @@ module Crown
|
|
54
54
|
# 指定した URL のクリップ数(ブックマーク数)を取得する.
|
55
55
|
#
|
56
56
|
# --------------------------------------------------------------- #
|
57
|
-
def count(uri, options =
|
57
|
+
def count(uri, options = {})
|
58
58
|
return Crown::Livedoor::ClipCounter.new.count(uri, options)
|
59
59
|
end
|
60
60
|
end # Clip
|
@@ -43,7 +43,7 @@ module Crown
|
|
43
43
|
# 指定したフィード URL の購読者数を取得する.
|
44
44
|
#
|
45
45
|
# ------------------------------------------------------------------- #
|
46
|
-
def Reader.count(feed_uri, options =
|
46
|
+
def Reader.count(feed_uri, options = {})
|
47
47
|
return Crown::Livedoor::ReadCounter.new.count(feed_uri, options)
|
48
48
|
end
|
49
49
|
|
@@ -54,7 +54,7 @@ module Crown
|
|
54
54
|
# 指定したフィード URL の購読者数を取得する.
|
55
55
|
#
|
56
56
|
# ------------------------------------------------------------------- #
|
57
|
-
def count(feed_uri, options =
|
57
|
+
def count(feed_uri, options = {})
|
58
58
|
return Crown::Livedoor::ReadCounter.new.count(feed_uri, options)
|
59
59
|
end
|
60
60
|
end # Reader
|
data/lib/crown/topsy.rb
CHANGED
@@ -42,7 +42,7 @@ module Crown
|
|
42
42
|
# Topsy の API を介して,指定した URL へのツイート数を取得する.
|
43
43
|
#
|
44
44
|
# ------------------------------------------------------------------- #
|
45
|
-
def Topsy.count(uri, options =
|
45
|
+
def Topsy.count(uri, options = {})
|
46
46
|
return Crown::Topsy::URICounter.new.count(uri, options)
|
47
47
|
end
|
48
48
|
|
@@ -53,9 +53,8 @@ module Crown
|
|
53
53
|
# Topsy の API を介して,指定した URL へのツイート数を取得する.
|
54
54
|
#
|
55
55
|
# ------------------------------------------------------------------- #
|
56
|
-
def count(uri, options =
|
56
|
+
def count(uri, options = {})
|
57
57
|
return Crown::Topsy::URICounter.new.count(uri, options)
|
58
58
|
end
|
59
|
-
|
60
59
|
end # Topsy
|
61
60
|
end # Crown
|
data/lib/crown/tweetmeme.rb
CHANGED
@@ -42,7 +42,7 @@ module Crown
|
|
42
42
|
# TweetMeme の API を介して,指定した URL へのツイート数を取得する.
|
43
43
|
#
|
44
44
|
# ------------------------------------------------------------------- #
|
45
|
-
def TweetMeme.count(uri, options =
|
45
|
+
def TweetMeme.count(uri, options = {})
|
46
46
|
return Crown::TweetMeme::URICounter.new.count(uri, options)
|
47
47
|
end
|
48
48
|
|
@@ -53,7 +53,7 @@ module Crown
|
|
53
53
|
# TweetMeme の API を介して,指定した URL へのツイート数を取得する.
|
54
54
|
#
|
55
55
|
# ------------------------------------------------------------------- #
|
56
|
-
def count(uri, options =
|
56
|
+
def count(uri, options = {})
|
57
57
|
return Crown::TweetMeme::URICounter.new.count(uri, options)
|
58
58
|
end
|
59
59
|
|
data/lib/crown/twitter.rb
CHANGED
@@ -47,7 +47,7 @@ module Crown
|
|
47
47
|
# 代替のメソッドを使用する事.
|
48
48
|
#
|
49
49
|
# ------------------------------------------------------------------- #
|
50
|
-
def count(screen_name, options =
|
50
|
+
def count(screen_name, options = {})
|
51
51
|
return Crown::Twitter::User.summary(screen_name, options)
|
52
52
|
end
|
53
53
|
|
data/lib/crown/twitter/uri.rb
CHANGED
@@ -46,14 +46,14 @@ module Crown
|
|
46
46
|
# ----------------------------------------------------------- #
|
47
47
|
# URI.count
|
48
48
|
# ----------------------------------------------------------- #
|
49
|
-
def URI.count(uri, options =
|
49
|
+
def URI.count(uri, options = {})
|
50
50
|
return Crown::Twitter::URICounter.new.count(uri, options)
|
51
51
|
end
|
52
52
|
|
53
53
|
# ----------------------------------------------------------- #
|
54
54
|
# count
|
55
55
|
# ----------------------------------------------------------- #
|
56
|
-
def count(uri, options =
|
56
|
+
def count(uri, options = {})
|
57
57
|
return Crown::Twitter::URICounter.new.count(uri, options)
|
58
58
|
end
|
59
59
|
end # URI
|
data/lib/crown/twitter/user.rb
CHANGED
@@ -47,28 +47,28 @@ module Crown
|
|
47
47
|
# ----------------------------------------------------------- #
|
48
48
|
# User.count
|
49
49
|
# ----------------------------------------------------------- #
|
50
|
-
def User.count(screen_name, options =
|
50
|
+
def User.count(screen_name, options = {})
|
51
51
|
return Crown::Twitter::TweetCounter.new.count(screen_name, options)
|
52
52
|
end
|
53
53
|
|
54
54
|
# ----------------------------------------------------------- #
|
55
55
|
# User.summary
|
56
56
|
# ----------------------------------------------------------- #
|
57
|
-
def User.summary(screen_name, options =
|
57
|
+
def User.summary(screen_name, options = {})
|
58
58
|
return Crown::Twitter::UserEntry.new.summary(screen_name, options)
|
59
59
|
end
|
60
60
|
|
61
61
|
# ----------------------------------------------------------- #
|
62
62
|
# count
|
63
63
|
# ----------------------------------------------------------- #
|
64
|
-
def count(screen_name, options =
|
64
|
+
def count(screen_name, options = {})
|
65
65
|
return Crown::Twitter::TweetCounter.new.count(screen_name, options)
|
66
66
|
end
|
67
67
|
|
68
68
|
# ----------------------------------------------------------- #
|
69
69
|
# summary
|
70
70
|
# ----------------------------------------------------------- #
|
71
|
-
def summary(screen_name, options =
|
71
|
+
def summary(screen_name, options = {})
|
72
72
|
return Crown::Twitter::UserEntry.new.summary(screen_name, options)
|
73
73
|
end
|
74
74
|
end # User
|
@@ -49,7 +49,20 @@ module Crown
|
|
49
49
|
# ------------------------------------------------------------------- #
|
50
50
|
# structures
|
51
51
|
# ------------------------------------------------------------------- #
|
52
|
-
Response = Struct.new(
|
52
|
+
Response = Struct.new(
|
53
|
+
:id, # Twitter ID
|
54
|
+
:lang, # �ݒ肳��Ă��錾��
|
55
|
+
:protected, # ����J�A�J�E���g���ǂ���
|
56
|
+
:name, # ���[�U��
|
57
|
+
:screen_name, # URL �ɕ\������閼�O
|
58
|
+
:image, # �v���t�B�[���A�C�R���� URL
|
59
|
+
:description, # ���ȏЉ
|
60
|
+
:status, # �c�C�[�g��
|
61
|
+
:favorite, # ���C�ɓ��萔
|
62
|
+
:friend, # �t�H���[��
|
63
|
+
:follower, # �t�H�����[��
|
64
|
+
:list # �o�^���ꂽ���X�g��
|
65
|
+
)
|
53
66
|
|
54
67
|
# ------------------------------------------------------------------- #
|
55
68
|
# Mix-in
|
@@ -84,11 +97,18 @@ module Crown
|
|
84
97
|
def parse(body)
|
85
98
|
json = JSON.parse(body)
|
86
99
|
result = Response.new
|
87
|
-
result.
|
88
|
-
result.
|
89
|
-
result.
|
90
|
-
result.
|
91
|
-
result.
|
100
|
+
result.id = json["id"].to_i
|
101
|
+
result.lang = json["lang"]
|
102
|
+
result.protected = json["protected"]
|
103
|
+
result.name = json["name"]
|
104
|
+
result.screen_name = json["screen_name"]
|
105
|
+
result.image = json["profile_image_url"]
|
106
|
+
result.description = json["description"]
|
107
|
+
result.status = json["statuses_count"].to_i
|
108
|
+
result.favorite = json["favourites_count"].to_i
|
109
|
+
result.friend = json["friends_count"].to_i
|
110
|
+
result.follower = json["followers_count"].to_i
|
111
|
+
result.list = json["listed_count"].to_i
|
92
112
|
return result
|
93
113
|
end
|
94
114
|
end # UserEntry
|
data/lib/crown/yahoo/bookmark.rb
CHANGED
@@ -34,11 +34,7 @@
|
|
34
34
|
module Crown
|
35
35
|
module Yahoo
|
36
36
|
# ------------------------------------------------------------------- #
|
37
|
-
#
|
38
|
-
# BookmarkCounter
|
39
|
-
#
|
40
|
-
# Yahoo! Japan ブックマーク API 経由の各種情報を取得するクラス.
|
41
|
-
#
|
37
|
+
# Bookmark
|
42
38
|
# ------------------------------------------------------------------- #
|
43
39
|
class Bookmark
|
44
40
|
require 'crown/yahoo/bookmark/counter'
|
@@ -50,7 +46,7 @@ module Crown
|
|
50
46
|
# 指定した URL のブックマーク数を取得する
|
51
47
|
#
|
52
48
|
# --------------------------------------------------------------- #
|
53
|
-
def Bookmark.count(uri, options =
|
49
|
+
def Bookmark.count(uri, options = {})
|
54
50
|
return Crown::Yahoo::BookmarkCounter.new.count(uri, options)
|
55
51
|
end
|
56
52
|
|
@@ -61,7 +57,7 @@ module Crown
|
|
61
57
|
# 指定した URL のブックマーク数を取得する
|
62
58
|
#
|
63
59
|
# --------------------------------------------------------------- #
|
64
|
-
def count(uri, options =
|
60
|
+
def count(uri, options = {})
|
65
61
|
return Crown::Yahoo::BookmarkCounter.new.count(uri, options)
|
66
62
|
end
|
67
63
|
end # Bookmark
|
data/test/crown-test.rb
CHANGED
@@ -62,7 +62,7 @@ class CrownTest < Test::Unit::TestCase
|
|
62
62
|
def test_delicious_count
|
63
63
|
# normal test
|
64
64
|
@@valid_uris.each { |uri|
|
65
|
-
assert(Crown::Delicious.count(uri)
|
65
|
+
assert(Crown::Delicious.count(uri) >= 0, "failed in " + uri)
|
66
66
|
}
|
67
67
|
end
|
68
68
|
|
@@ -72,7 +72,7 @@ class CrownTest < Test::Unit::TestCase
|
|
72
72
|
def test_livedoor_count
|
73
73
|
# normal test
|
74
74
|
@@valid_uris.each { |uri|
|
75
|
-
assert(Crown::Livedoor::Clip.count(uri)
|
75
|
+
assert(Crown::Livedoor::Clip.count(uri) >= 0, "failed in " + uri)
|
76
76
|
}
|
77
77
|
end
|
78
78
|
|
@@ -82,7 +82,7 @@ class CrownTest < Test::Unit::TestCase
|
|
82
82
|
def test_buzzurl_count
|
83
83
|
# normal test
|
84
84
|
@@valid_uris.each { |uri|
|
85
|
-
assert(Crown::Buzzurl.count(uri)
|
85
|
+
assert(Crown::Buzzurl.count(uri) >= 0, "failed in " + uri)
|
86
86
|
}
|
87
87
|
end
|
88
88
|
|
@@ -92,7 +92,7 @@ class CrownTest < Test::Unit::TestCase
|
|
92
92
|
def test_yahoo_count
|
93
93
|
# normal test
|
94
94
|
@@valid_uris.each { |uri|
|
95
|
-
assert(Crown::Yahoo::Bookmark.count(uri)
|
95
|
+
assert(Crown::Yahoo::Bookmark.count(uri) >= 0, "failed in " + uri)
|
96
96
|
}
|
97
97
|
end
|
98
98
|
|
@@ -117,7 +117,7 @@ class CrownTest < Test::Unit::TestCase
|
|
117
117
|
def test_topsy_count
|
118
118
|
# normal test
|
119
119
|
@@valid_uris.each { |uri|
|
120
|
-
assert(Crown::Topsy.count(uri)
|
120
|
+
assert(Crown::Topsy.count(uri) >= 0, "failed in " + uri)
|
121
121
|
}
|
122
122
|
end
|
123
123
|
|
@@ -127,7 +127,7 @@ class CrownTest < Test::Unit::TestCase
|
|
127
127
|
def test_tweetmeme_count
|
128
128
|
# normal test
|
129
129
|
@@valid_uris.each { |uri|
|
130
|
-
assert(Crown::TweetMeme.count(uri)
|
130
|
+
assert(Crown::TweetMeme.count(uri) >= 0, "failed in " + uri)
|
131
131
|
}
|
132
132
|
end
|
133
133
|
|
@@ -142,10 +142,30 @@ class CrownTest < Test::Unit::TestCase
|
|
142
142
|
#def test_backtype_count
|
143
143
|
# Crown::BackType.api_key = "your_api_key"
|
144
144
|
# @@valid_uris.each { |uri|
|
145
|
-
# assert(Crown::BackType.count(uri)
|
145
|
+
# assert(Crown::BackType.count(uri) >= 0, "failed in " + uri)
|
146
146
|
# }
|
147
147
|
#end
|
148
148
|
|
149
|
+
# ----------------------------------------------------------------------- #
|
150
|
+
# test_linkedin_count
|
151
|
+
# ----------------------------------------------------------------------- #
|
152
|
+
def test_linkedin_count
|
153
|
+
# normal test
|
154
|
+
@@valid_uris.each { |uri|
|
155
|
+
assert(Crown::LinkedIn.count(uri) >= 0, "failed in " + uri)
|
156
|
+
}
|
157
|
+
end
|
158
|
+
|
159
|
+
# ----------------------------------------------------------------------- #
|
160
|
+
# test_google_plus1_count
|
161
|
+
# ----------------------------------------------------------------------- #
|
162
|
+
def test_google_plus1_count
|
163
|
+
# normal test
|
164
|
+
@@valid_uris.each { |uri|
|
165
|
+
assert(Crown::Google::PlusOne.count(uri) >= 0, "failed in " + uri)
|
166
|
+
}
|
167
|
+
end
|
168
|
+
|
149
169
|
# ----------------------------------------------------------------------- #
|
150
170
|
# test_cgm
|
151
171
|
# ----------------------------------------------------------------------- #
|
@@ -156,6 +176,8 @@ class CrownTest < Test::Unit::TestCase
|
|
156
176
|
:tweetmeme, # TweetMeme
|
157
177
|
# :backtype, # BackTweets (要 API key)
|
158
178
|
:facebook, # Facebook
|
179
|
+
:google_plus1, # Google+1
|
180
|
+
:linkedin, # LinkedIn
|
159
181
|
:hatena_bookmark, # はてなブックマーク
|
160
182
|
:livedoor_clip, # Livedoor クリップ
|
161
183
|
:delicious, # Delicious
|
@@ -165,19 +187,19 @@ class CrownTest < Test::Unit::TestCase
|
|
165
187
|
|
166
188
|
@@valid_uris.each { |uri|
|
167
189
|
services.each { |service|
|
168
|
-
assert(Crown::CGM.proxy(service).count(uri) >= 0, "failed in " + uri)
|
190
|
+
assert(Crown::CGM.proxy(service).count(uri) >= 0, "failed in " + service.to_s + "," + uri)
|
169
191
|
}
|
170
192
|
}
|
171
193
|
end
|
172
194
|
|
173
195
|
# ----------------------------------------------------------------------- #
|
174
|
-
#
|
196
|
+
# test_twitter_user_summary
|
175
197
|
# ----------------------------------------------------------------------- #
|
176
|
-
def
|
198
|
+
def test_twitter_user_summary
|
177
199
|
# normal test
|
178
200
|
@@valid_users.each { |screen_name|
|
179
|
-
counter = Crown::Twitter.
|
180
|
-
assert(counter != nil, "failed in Crown::Twitter.
|
201
|
+
counter = Crown::Twitter::User.summary(screen_name)
|
202
|
+
assert(counter != nil, "failed in Crown::Twitter::User.summary: " + screen_name)
|
181
203
|
assert(counter.status > 0, "wrong statuses count: " + screen_name)
|
182
204
|
assert(counter.favorite > 0, "wrong favorites count: " + screen_name)
|
183
205
|
assert(counter.friend > 0, "wrong friends count: " + screen_name)
|