crown 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,4 +1,8 @@
1
+ == 0.0.3 / 2011-02-19
2
+
3
+ * add Facebook module
4
+ * add Twitter-related modules (Topsy/TweetMeme/BackType)
5
+
1
6
  == 0.0.1 / 2011-02-18
2
7
 
3
8
  * initial release
4
-
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
data/crown.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{crown}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["clown"]
data/lib/crown.rb CHANGED
@@ -46,5 +46,5 @@ require 'crown/backtype'
46
46
  require 'crown/facebook'
47
47
 
48
48
  module Crown
49
- VERSION = '0.0.2'
49
+ VERSION = '0.0.3'
50
50
  end
@@ -47,8 +47,8 @@ module Crown
47
47
  return 0 if (api_key == nil)
48
48
 
49
49
  begin
50
- session = Net::HTTP.new("api.backtype.com", 80, proxy_host, proxy_port)
51
- path = "/tweetcount.json?q=" + CGI.escape(uri) + "&key=" + api_key
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
 
@@ -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("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)
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 = "/entry.count?url=" + CGI.escape(uri)
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("otter.topsy.com", 80, proxy_host, proxy_port)
49
- path = "urlinfo.json?url=" + CGI.escape(uri)
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
 
@@ -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("api.tweetmeme.com", 80, proxy_host, proxy_port)
49
- path = "/url_info.json?url=" + CGI.escape(uri)
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("api.twitter.com", 80, proxy_host, proxy_port)
54
- path = "/1/users/show.json?screen_name=" + CGI.escape(screen_name)
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
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crown
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - clown