crown 0.0.2 → 0.0.3
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/ChangeLog +5 -1
- data/VERSION +1 -1
- data/crown.gemspec +1 -1
- data/lib/crown.rb +1 -1
- data/lib/crown/backtype.rb +2 -2
- data/lib/crown/facebook.rb +3 -3
- data/lib/crown/hatena/bookmark.rb +1 -1
- data/lib/crown/topsy.rb +2 -2
- data/lib/crown/tweetmeme.rb +2 -2
- data/lib/crown/twitter.rb +2 -2
- data/test/crown_test.rb +10 -0
- metadata +3 -3
data/ChangeLog
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/crown.gemspec
CHANGED
data/lib/crown.rb
CHANGED
data/lib/crown/backtype.rb
CHANGED
@@ -47,8 +47,8 @@ module Crown
|
|
47
47
|
return 0 if (api_key == nil)
|
48
48
|
|
49
49
|
begin
|
50
|
-
session = Net::HTTP.new(
|
51
|
-
path =
|
50
|
+
session = Net::HTTP.new('api.backtype.com', 80, proxy_host, proxy_port)
|
51
|
+
path = '/tweetcount.json?q=' + CGI.escape(uri) + '&key=' + api_key
|
52
52
|
response = Crown::HTTP.get(session, path)
|
53
53
|
return nil if (response == nil || response.code.to_i != 200)
|
54
54
|
|
data/lib/crown/facebook.rb
CHANGED
@@ -49,9 +49,9 @@ module Crown
|
|
49
49
|
# ------------------------------------------------------------------- #
|
50
50
|
def count(uri, proxy_host = nil, proxy_port = nil)
|
51
51
|
begin
|
52
|
-
session = Net::HTTP.new(
|
53
|
-
query =
|
54
|
-
path =
|
52
|
+
session = Net::HTTP.new('api.facebook.com', 80, proxy_host, proxy_port)
|
53
|
+
query = 'select like_count, total_count, share_count, click_count from link_stat where url="' + uri + '"'
|
54
|
+
path = '/method/fql.query?query=' + CGI.escape(query)
|
55
55
|
response = Crown::HTTP.get(session, path)
|
56
56
|
return nil if (response == nil || response.code.to_i != 200)
|
57
57
|
|
@@ -155,7 +155,7 @@ module Crown
|
|
155
155
|
# --------------------------------------------------------------- #
|
156
156
|
def count(uri, proxy_host = nil, proxy_port = nil)
|
157
157
|
session = Net::HTTP.new('api.b.st-hatena.com', 80, proxy_host, proxy_port)
|
158
|
-
path =
|
158
|
+
path = '/entry.count?url=' + CGI.escape(uri)
|
159
159
|
begin
|
160
160
|
result = Crown::HTTP.get(session, path)
|
161
161
|
return 0 if (result == nil || result.code.to_i != 200)
|
data/lib/crown/topsy.rb
CHANGED
@@ -45,8 +45,8 @@ module Crown
|
|
45
45
|
# ------------------------------------------------------------------- #
|
46
46
|
def count(uri, proxy_host = nil, proxy_port = nil)
|
47
47
|
begin
|
48
|
-
session = Net::HTTP.new(
|
49
|
-
path =
|
48
|
+
session = Net::HTTP.new('otter.topsy.com', 80, proxy_host, proxy_port)
|
49
|
+
path = '/urlinfo.json?url=' + CGI.escape(uri)
|
50
50
|
response = Crown::HTTP.get(session, path)
|
51
51
|
return nil if (response == nil || response.code.to_i != 200)
|
52
52
|
|
data/lib/crown/tweetmeme.rb
CHANGED
@@ -45,8 +45,8 @@ module Crown
|
|
45
45
|
# ------------------------------------------------------------------- #
|
46
46
|
def count(uri, proxy_host = nil, proxy_port = nil)
|
47
47
|
begin
|
48
|
-
session = Net::HTTP.new(
|
49
|
-
path =
|
48
|
+
session = Net::HTTP.new('api.tweetmeme.com', 80, proxy_host, proxy_port)
|
49
|
+
path = '/url_info.json?url=' + CGI.escape(uri)
|
50
50
|
response = Crown::HTTP.get(session, path)
|
51
51
|
return nil if (response == nil || response.code.to_i != 200)
|
52
52
|
|
data/lib/crown/twitter.rb
CHANGED
@@ -50,8 +50,8 @@ module Crown
|
|
50
50
|
# ------------------------------------------------------------------- #
|
51
51
|
def count(screen_name, proxy_host = nil, proxy_port = nil)
|
52
52
|
begin
|
53
|
-
session = Net::HTTP.new(
|
54
|
-
path =
|
53
|
+
session = Net::HTTP.new('api.twitter.com', 80, proxy_host, proxy_port)
|
54
|
+
path = '/1/users/show.json?screen_name=' + CGI.escape(screen_name)
|
55
55
|
response = Crown::HTTP.get(session, path)
|
56
56
|
return nil if (response == nil || response.code.to_i != 200)
|
57
57
|
|
data/test/crown_test.rb
CHANGED
@@ -54,6 +54,7 @@ class CrownTest < Test::Unit::TestCase
|
|
54
54
|
# test_hatena_count
|
55
55
|
# ----------------------------------------------------------------------- #
|
56
56
|
def test_hatena_count
|
57
|
+
# normal test
|
57
58
|
@@valid_uris.each { |uri|
|
58
59
|
assert(Crown::Hatena::Bookmark.count(uri) > 0, "failed in " + uri)
|
59
60
|
}
|
@@ -63,6 +64,7 @@ class CrownTest < Test::Unit::TestCase
|
|
63
64
|
# test_delicious_count
|
64
65
|
# ----------------------------------------------------------------------- #
|
65
66
|
def test_delicious_count
|
67
|
+
# normal test
|
66
68
|
@@valid_uris.each { |uri|
|
67
69
|
assert(Crown::Delicious.count(uri) > 0, "failed in " + uri)
|
68
70
|
}
|
@@ -72,6 +74,7 @@ class CrownTest < Test::Unit::TestCase
|
|
72
74
|
# test_livedoor_count
|
73
75
|
# ----------------------------------------------------------------------- #
|
74
76
|
def test_livedoor_count
|
77
|
+
# normal test
|
75
78
|
@@valid_uris.each { |uri|
|
76
79
|
assert(Crown::Delicious.count(uri) > 0, "failed in " + uri)
|
77
80
|
}
|
@@ -81,6 +84,7 @@ class CrownTest < Test::Unit::TestCase
|
|
81
84
|
# test_buzzurl_count
|
82
85
|
# ----------------------------------------------------------------------- #
|
83
86
|
def test_buzzurl_count
|
87
|
+
# normal test
|
84
88
|
@@valid_uris.each { |uri|
|
85
89
|
assert(Crown::Buzzurl.count(uri) > 0, "failed in " + uri)
|
86
90
|
}
|
@@ -90,6 +94,7 @@ class CrownTest < Test::Unit::TestCase
|
|
90
94
|
# test_yahoo_count
|
91
95
|
# ----------------------------------------------------------------------- #
|
92
96
|
def test_yahoo_count
|
97
|
+
# normal test
|
93
98
|
@@valid_uris.each { |uri|
|
94
99
|
assert(Crown::Yahoo::Bookmark.count(uri) > 0, "failed in " + uri)
|
95
100
|
}
|
@@ -99,6 +104,7 @@ class CrownTest < Test::Unit::TestCase
|
|
99
104
|
# test_facebook_count
|
100
105
|
# ----------------------------------------------------------------------- #
|
101
106
|
def test_facebook_count
|
107
|
+
# normal test
|
102
108
|
@@valid_uris.each { |uri|
|
103
109
|
counter = Crown::Facebook.count(uri)
|
104
110
|
assert(counter != nil, "failed in Crown::Facebook.count: " + uri)
|
@@ -113,6 +119,7 @@ class CrownTest < Test::Unit::TestCase
|
|
113
119
|
# test_topsy_count
|
114
120
|
# ----------------------------------------------------------------------- #
|
115
121
|
def test_topsy_count
|
122
|
+
# normal test
|
116
123
|
@@valid_uris.each { |uri|
|
117
124
|
assert(Crown::Topsy.count(uri) > 0, "failed in " + uri)
|
118
125
|
}
|
@@ -122,6 +129,7 @@ class CrownTest < Test::Unit::TestCase
|
|
122
129
|
# test_tweetmeme_count
|
123
130
|
# ----------------------------------------------------------------------- #
|
124
131
|
def test_tweetmeme_count
|
132
|
+
# normal test
|
125
133
|
@@valid_uris.each { |uri|
|
126
134
|
assert(Crown::TweetMeme.count(uri) > 0, "failed in " + uri)
|
127
135
|
}
|
@@ -131,6 +139,7 @@ class CrownTest < Test::Unit::TestCase
|
|
131
139
|
# test_backtype_count
|
132
140
|
# ----------------------------------------------------------------------- #
|
133
141
|
def test_backtype_count
|
142
|
+
# normal test
|
134
143
|
@@valid_uris.each { |uri|
|
135
144
|
assert(Crown::BackType.count(uri, "your_api_key") > 0, "failed in " + uri)
|
136
145
|
}
|
@@ -140,6 +149,7 @@ class CrownTest < Test::Unit::TestCase
|
|
140
149
|
# test_twitter_count
|
141
150
|
# ----------------------------------------------------------------------- #
|
142
151
|
def test_twitter_count
|
152
|
+
# normal test
|
143
153
|
@@valid_users.each { |screen_name|
|
144
154
|
counter = Crown::Twitter.count(screen_name)
|
145
155
|
assert(counter != nil, "failed in Crown::Twitter.count: " + screen_name)
|
metadata
CHANGED