alexa 0.6.3 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +8 -6
- data/Gemfile +0 -4
- data/alexa.gemspec +14 -8
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/alexa.rb +2 -1
- data/lib/alexa/connection.rb +43 -46
- data/lib/alexa/version.rb +1 -1
- metadata +28 -33
- data/test/api/category_browse_test.rb +0 -41
- data/test/api/category_listings_test.rb +0 -37
- data/test/api/sites_linking_in_test.rb +0 -37
- data/test/api/traffic_history_test.rb +0 -58
- data/test/api/url_info_test.rb +0 -130
- data/test/client_test.rb +0 -65
- data/test/connection_test.rb +0 -46
- data/test/fixtures/bad_request.txt +0 -8
- data/test/fixtures/category_browse/card_games.txt +0 -480
- data/test/fixtures/category_listings/card_games.txt +0 -138
- data/test/fixtures/forbidden.txt +0 -7
- data/test/fixtures/sites_linking_in/github_count_3.txt +0 -24
- data/test/fixtures/traffic_history/alexa_error.txt +0 -8
- data/test/fixtures/traffic_history/github.txt +0 -325
- data/test/fixtures/unathorized.txt +0 -7
- data/test/fixtures/url_info/custom-response-group.txt +0 -22
- data/test/fixtures/url_info/empty_group.txt +0 -8
- data/test/fixtures/url_info/github_full.txt +0 -2853
- data/test/fixtures/url_info/github_rank.txt +0 -14
- data/test/helper.rb +0 -22
- data/test/utils_test.rb +0 -54
@@ -1,14 +0,0 @@
|
|
1
|
-
HTTP/1.1 200 OK
|
2
|
-
Server: Apache-Coyote/1.1
|
3
|
-
Content-Type: text/xml
|
4
|
-
Transfer-Encoding: chunked
|
5
|
-
Date: Wed, 12 Oct 2011 21:18:48 GMT
|
6
|
-
|
7
|
-
<?xml version="1.0"?>
|
8
|
-
<aws:UrlInfoResponse xmlns:aws="http://alexa.amazonaws.com/doc/2005-07-11/"><aws:Response xmlns:aws="http://awis.amazonaws.com/doc/2005-07-11"><aws:OperationRequest><aws:RequestId>b9574986-bda8-83e2-cc0b-41457a7168d0</aws:RequestId></aws:OperationRequest><aws:UrlInfoResult><aws:Alexa>
|
9
|
-
|
10
|
-
<aws:TrafficData>
|
11
|
-
<aws:DataUrl type="canonical">github.com/</aws:DataUrl>
|
12
|
-
<aws:Rank>551</aws:Rank>
|
13
|
-
</aws:TrafficData>
|
14
|
-
</aws:Alexa></aws:UrlInfoResult><aws:ResponseStatus xmlns:aws="http://alexa.amazonaws.com/doc/2005-07-11/"><aws:StatusCode>Success</aws:StatusCode></aws:ResponseStatus></aws:Response></aws:UrlInfoResponse>
|
data/test/helper.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require "minitest/autorun"
|
2
|
-
require "webmock/minitest"
|
3
|
-
require "mocha/setup"
|
4
|
-
|
5
|
-
require "alexa"
|
6
|
-
|
7
|
-
xml_parser = ENV["XML_PARSER"] || "libxml"
|
8
|
-
|
9
|
-
require xml_parser if ["nokogiri", "libxml", "ox"].include?(xml_parser)
|
10
|
-
MultiXml.parser = xml_parser
|
11
|
-
|
12
|
-
class MiniTest::Test
|
13
|
-
def setup
|
14
|
-
WebMock.disable_net_connect!
|
15
|
-
end
|
16
|
-
|
17
|
-
# Recording response is as simple as writing in terminal:
|
18
|
-
# curl -is -X GET "http://awis.amazonaws.com/?Action=UrlInfo&AWSAccessKeyId=fake" > response.txt
|
19
|
-
def fixture(filename)
|
20
|
-
File.read(File.join("test", "fixtures", filename))
|
21
|
-
end
|
22
|
-
end
|
data/test/utils_test.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
|
3
|
-
describe Alexa::Utils do
|
4
|
-
describe "#safe_retrieve" do
|
5
|
-
it "returns nested hash value" do
|
6
|
-
hash = {:first => {:second => {:third => "Value!"}}}
|
7
|
-
assert_equal "Value!", Alexa::Utils.safe_retrieve(hash, :first, :second, :third)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "returns partial hash when not all keys given" do
|
11
|
-
hash = {:first => {:second => {:third => "Value!"}}}
|
12
|
-
assert_equal({:third => "Value!"}, Alexa::Utils.safe_retrieve(hash, :first, :second))
|
13
|
-
end
|
14
|
-
|
15
|
-
it "returns nil when key not found in hash" do
|
16
|
-
hash = {:first => {:second => {:third => "Value!"}}}
|
17
|
-
assert_nil Alexa::Utils.safe_retrieve(hash, :non_exisiting)
|
18
|
-
end
|
19
|
-
|
20
|
-
it "returns nil when one of keys not found in hash" do
|
21
|
-
hash = {:first => {:second => {:third => "Value!"}}}
|
22
|
-
assert_nil Alexa::Utils.safe_retrieve(hash, :first, :non_exisiting)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "returns nil when given more keys than present in hash" do
|
26
|
-
hash = {:first => {:second => {:third => "Value!"}}}
|
27
|
-
assert_nil Alexa::Utils.safe_retrieve(hash, :first, :second, :third, :fourth)
|
28
|
-
end
|
29
|
-
|
30
|
-
it "returns nil when non hash object given" do
|
31
|
-
assert_nil Alexa::Utils.safe_retrieve("And Now for Something Completely Different")
|
32
|
-
end
|
33
|
-
|
34
|
-
it "returns nil when no keys given" do
|
35
|
-
hash = {:first => {:second => {:third => "Value!"}}}
|
36
|
-
assert_nil Alexa::Utils.safe_retrieve(hash)
|
37
|
-
end
|
38
|
-
|
39
|
-
it "does not return incidental value" do
|
40
|
-
hash = {nil => "value"}
|
41
|
-
assert_nil Alexa::Utils.safe_retrieve(hash)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe "#camelize" do
|
46
|
-
it "uppercases word" do
|
47
|
-
assert_equal "Big", Alexa::Utils.camelize("big")
|
48
|
-
end
|
49
|
-
|
50
|
-
it "removes underscores" do
|
51
|
-
assert_equal "BigBen", Alexa::Utils.camelize("big_ben")
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|