yahoo-se 1.0.8 → 1.0.9
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/lib/yahoo-se/exceptions.rb +10 -3
- data/lib/yahoo-se/request.rb +5 -1
- data/lib/yahoo-se/version.rb +1 -1
- metadata +1 -1
data/lib/yahoo-se/exceptions.rb
CHANGED
@@ -3,9 +3,16 @@ module Yahoo
|
|
3
3
|
class ApplicationIDNotSet < RuntimeError; end
|
4
4
|
class ResponseError < RuntimeError
|
5
5
|
def initialize(errors)
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
case errors.class
|
7
|
+
when Hash
|
8
|
+
title = errors["Title"]
|
9
|
+
message = errors["Message"]
|
10
|
+
puts "#{title} : #{message}"
|
11
|
+
when String
|
12
|
+
puts errors
|
13
|
+
else
|
14
|
+
puts errors.to_s
|
15
|
+
end
|
9
16
|
end
|
10
17
|
end
|
11
18
|
end
|
data/lib/yahoo-se/request.rb
CHANGED
@@ -30,7 +30,11 @@ module Yahoo
|
|
30
30
|
|
31
31
|
# The response body of the request
|
32
32
|
def response_body
|
33
|
-
|
33
|
+
begin
|
34
|
+
@response_body = open(path,"User-Agent" => "Ruby/Yahoo Site Explorer Gem v#{Yahoo::SE::VERSION}").readlines.join
|
35
|
+
rescue OpenURI::HTTPError => @errors
|
36
|
+
raise ResponseError, @errors
|
37
|
+
end
|
34
38
|
end
|
35
39
|
|
36
40
|
# The results from the response object
|
data/lib/yahoo-se/version.rb
CHANGED