alexa 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/alexa.gemspec +6 -4
- data/lib/alexa/url_info.rb +1 -1
- data/test/alexa_test.rb +27 -33
- metadata +3 -3
data/Rakefile
CHANGED
@@ -7,6 +7,7 @@ begin
|
|
7
7
|
require 'jeweler'
|
8
8
|
Jeweler::Tasks.new do |gem|
|
9
9
|
gem.name = "alexa"
|
10
|
+
gem.description = %Q{Alexa Web Information Service library (AWIS)}
|
10
11
|
gem.summary = %Q{Alexa Web Information Service library}
|
11
12
|
gem.email = "w.wnetrzak@gmail.com"
|
12
13
|
gem.homepage = "http://github.com/morgoth/alexa"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
data/alexa.gemspec
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{alexa}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Wojciech Wnętrzak"]
|
12
|
-
s.date = %q{2009-
|
12
|
+
s.date = %q{2009-11-03}
|
13
|
+
s.description = %q{Alexa Web Information Service library (AWIS)}
|
13
14
|
s.email = %q{w.wnetrzak@gmail.com}
|
14
15
|
s.extra_rdoc_files = [
|
15
16
|
"LICENSE",
|
@@ -54,3 +55,4 @@ Gem::Specification.new do |s|
|
|
54
55
|
s.add_dependency(%q<xml-simple>, [">= 0"])
|
55
56
|
end
|
56
57
|
end
|
58
|
+
|
data/lib/alexa/url_info.rb
CHANGED
@@ -88,7 +88,7 @@ module Alexa
|
|
88
88
|
"Timestamp" => timestamp,
|
89
89
|
"ResponseGroup" => response_group,
|
90
90
|
"Url" => host
|
91
|
-
}.to_a.collect{|item| item.first + "=" + CGI::escape(item.last) }.join("&")
|
91
|
+
}.to_a.collect{ |item| item.first + "=" + CGI::escape(item.last) }.sort.join("&")
|
92
92
|
)
|
93
93
|
end
|
94
94
|
end
|
data/test/alexa_test.rb
CHANGED
@@ -4,9 +4,9 @@ class AlexaTest < Test::Unit::TestCase
|
|
4
4
|
context "Alexa::UrlInfo" do
|
5
5
|
setup do
|
6
6
|
@alexa = Alexa::UrlInfo.new(
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
:access_key_id => "12345678901234567890",
|
8
|
+
:secret_access_key => "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDF",
|
9
|
+
:host => "some.host"
|
10
10
|
)
|
11
11
|
end
|
12
12
|
|
@@ -16,7 +16,7 @@ class AlexaTest < Test::Unit::TestCase
|
|
16
16
|
end
|
17
17
|
|
18
18
|
should "Generate url" do
|
19
|
-
url = @alexa.send(
|
19
|
+
url = @alexa.send(:generate_url,
|
20
20
|
"UrlInfo",
|
21
21
|
@alexa.access_key_id,
|
22
22
|
"I1mPdBy+flhhzqqUaamNq9gq190=",
|
@@ -24,12 +24,8 @@ class AlexaTest < Test::Unit::TestCase
|
|
24
24
|
"Rank,ContactInfo,AdultContent,Speed,Language,Keywords,OwnedDomains,LinksInCount,SiteData,RelatedLinks",
|
25
25
|
"heroku.com"
|
26
26
|
)
|
27
|
-
|
28
|
-
|
29
|
-
else
|
30
|
-
expected_uri = "/?Action=UrlInfo&Signature=I1mPdBy%2BflhhzqqUaamNq9gq190%3D&AWSAccessKeyId=12345678901234567890&Url=heroku.com&Timestamp=2009-07-03T07%3A22%3A24.000Z&ResponseGroup=Rank%2CContactInfo%2CAdultContent%2CSpeed%2CLanguage%2CKeywords%2COwnedDomains%2CLinksInCount%2CSiteData%2CRelatedLinks"
|
31
|
-
assert_equal expected_uri, url.request_uri
|
32
|
-
end
|
27
|
+
expected_uri = "/?AWSAccessKeyId=12345678901234567890&Action=UrlInfo&ResponseGroup=Rank%2CContactInfo%2CAdultContent%2CSpeed%2CLanguage%2CKeywords%2COwnedDomains%2CLinksInCount%2CSiteData%2CRelatedLinks&Signature=I1mPdBy%2BflhhzqqUaamNq9gq190%3D&Timestamp=2009-07-03T07%3A22%3A24.000Z&Url=heroku.com"
|
28
|
+
assert_equal expected_uri, url.request_uri
|
33
29
|
assert_equal "awis.amazonaws.com", url.host
|
34
30
|
end
|
35
31
|
|
@@ -103,7 +99,7 @@ class AlexaTest < Test::Unit::TestCase
|
|
103
99
|
end
|
104
100
|
|
105
101
|
should "return related links" do
|
106
|
-
assert_equal 10, @alexa.related_links.
|
102
|
+
assert_equal 10, @alexa.related_links.size
|
107
103
|
end
|
108
104
|
|
109
105
|
should "return speed_median load time" do
|
@@ -115,17 +111,16 @@ class AlexaTest < Test::Unit::TestCase
|
|
115
111
|
end
|
116
112
|
|
117
113
|
should "return rank by country" do
|
118
|
-
assert_equal 3, @alexa.rank_by_country.
|
114
|
+
assert_equal 3, @alexa.rank_by_country.size
|
119
115
|
end
|
120
116
|
|
121
117
|
should "return rank by city" do
|
122
|
-
assert_equal 68, @alexa.rank_by_city.
|
118
|
+
assert_equal 68, @alexa.rank_by_city.size
|
123
119
|
end
|
124
120
|
|
125
121
|
should "return usage statistics" do
|
126
|
-
assert_equal 4, @alexa.usage_statistics.
|
122
|
+
assert_equal 4, @alexa.usage_statistics.size
|
127
123
|
end
|
128
|
-
|
129
124
|
end
|
130
125
|
|
131
126
|
context "should not crash when parsing empty xml response and" do
|
@@ -134,62 +129,61 @@ class AlexaTest < Test::Unit::TestCase
|
|
134
129
|
@alexa.parse_xml(xml)
|
135
130
|
end
|
136
131
|
|
137
|
-
should "return nil" do
|
132
|
+
should "return nil from rank" do
|
138
133
|
assert_nil @alexa.rank
|
139
134
|
end
|
140
135
|
|
141
|
-
should "return nil" do
|
142
|
-
|
136
|
+
should "return nil from data_url" do
|
137
|
+
assert_equal "404", @alexa.data_url
|
143
138
|
end
|
144
139
|
|
145
|
-
should "return nil" do
|
146
|
-
|
140
|
+
should "return nil from site_title" do
|
141
|
+
assert_equal "404", @alexa.site_title
|
147
142
|
end
|
148
143
|
|
149
|
-
should "return nil" do
|
144
|
+
should "return nil from site_description" do
|
150
145
|
assert_nil @alexa.site_description
|
151
146
|
end
|
152
147
|
|
153
|
-
should "return nil" do
|
148
|
+
should "return nil from language_locale" do
|
154
149
|
assert_nil @alexa.language_locale
|
155
150
|
end
|
156
151
|
|
157
|
-
should "return nil" do
|
152
|
+
should "return nil from language_encoding" do
|
158
153
|
assert_nil @alexa.language_encoding
|
159
154
|
end
|
160
155
|
|
161
|
-
should "return nil" do
|
156
|
+
should "return nil from links_in_count" do
|
162
157
|
assert_nil @alexa.links_in_count
|
163
158
|
end
|
164
159
|
|
165
|
-
should "return nil" do
|
160
|
+
should "return nil from keywords" do
|
166
161
|
assert_nil @alexa.keywords
|
167
162
|
end
|
168
163
|
|
169
|
-
should "return nil" do
|
164
|
+
should "return nil from related_links" do
|
170
165
|
assert_nil @alexa.related_links
|
171
166
|
end
|
172
167
|
|
173
|
-
should "return nil" do
|
168
|
+
should "return nil from speed_median_load_time" do
|
174
169
|
assert_nil @alexa.speed_median_load_time
|
175
170
|
end
|
176
171
|
|
177
|
-
should "return nil" do
|
172
|
+
should "return nil from speed_percentile" do
|
178
173
|
assert_nil @alexa.speed_percentile
|
179
174
|
end
|
180
175
|
|
181
|
-
should "return nil" do
|
176
|
+
should "return nil from rank_by_country" do
|
182
177
|
assert_nil @alexa.rank_by_country
|
183
178
|
end
|
184
179
|
|
185
|
-
should "return nil" do
|
180
|
+
should "return nil from rank_by_city" do
|
186
181
|
assert_nil @alexa.rank_by_city
|
187
182
|
end
|
188
183
|
|
189
|
-
should "return nil" do
|
184
|
+
should "return nil from usage_statistics" do
|
190
185
|
assert_nil @alexa.usage_statistics
|
191
186
|
end
|
192
|
-
|
193
187
|
end
|
194
188
|
|
195
189
|
should "not raise error when response is OK" do
|
@@ -221,4 +215,4 @@ class AlexaTest < Test::Unit::TestCase
|
|
221
215
|
)
|
222
216
|
end
|
223
217
|
end
|
224
|
-
end
|
218
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alexa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Wojciech Wn\xC4\x99trzak"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-03 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: "0"
|
24
24
|
version:
|
25
|
-
description:
|
25
|
+
description: Alexa Web Information Service library (AWIS)
|
26
26
|
email: w.wnetrzak@gmail.com
|
27
27
|
executables: []
|
28
28
|
|