yahoo-se 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
data/lib/yahoo-se/exceptions.rb
CHANGED
data/lib/yahoo-se/response.rb
CHANGED
@@ -3,10 +3,11 @@ module Yahoo
|
|
3
3
|
class Response
|
4
4
|
def initialize(response_body)
|
5
5
|
@body = response_body
|
6
|
+
raise RateLimitExceeded unless @body.to_json["Error"].nil?
|
6
7
|
end
|
7
8
|
|
8
9
|
# The number of URLs returned. This may be lower than the number of results requested if there were fewer total results available.
|
9
|
-
def
|
10
|
+
def total_results_returned
|
10
11
|
self.to_json["ResultSet"]["totalResultsReturned"].to_i
|
11
12
|
end
|
12
13
|
|
data/lib/yahoo-se/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"Error":{"Message":"limit exceeded"}}
|
@@ -10,10 +10,14 @@ describe Yahoo::SE::Response do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should show the total results return from the request" do
|
13
|
-
@response.
|
13
|
+
@response.total_results_returned.should == 100
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should show the total results found from Yahoo!" do
|
17
17
|
@response.total_results_available.should == 328
|
18
18
|
end
|
19
|
+
|
20
|
+
it "should raise RateLimitExceeded when there are too many requests" do
|
21
|
+
lambda {Yahoo::SE::Response.new(fixture("rate_limit_exceeded.json"))}.should raise_error(Yahoo::SE::RateLimitExceeded)
|
22
|
+
end
|
19
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yahoo-se
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lance Carlson
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-12-04 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- spec/fixtures/erbmicha.com_backlinks.json
|
60
60
|
- spec/fixtures/erbmicha.com_pages.json
|
61
61
|
- spec/fixtures/erbmicha.com_ping.json
|
62
|
+
- spec/fixtures/rate_limit_exceeded.json
|
62
63
|
- spec/spec.opts
|
63
64
|
- spec/spec_helper.rb
|
64
65
|
- spec/yahoo-se
|