jpignata-bossman 0.0.2 → 0.0.3
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/README +10 -2
- data/bossman.gemspec +3 -4
- data/lib/bossman.rb +10 -6
- metadata +4 -4
data/README
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
-
|
1
|
+
= BOSSMan -- Class for interaction with the Yahoo BOSS web service
|
2
|
+
|
3
|
+
== Description
|
4
|
+
|
5
|
+
BOSSMan can be used to perform image, web and news searches against Yahoo's index. For more information about BOSS (Build your Own Search Service) please refer to http://developer.yahoo.com/search/boss/
|
6
|
+
|
7
|
+
== Installation
|
8
|
+
|
9
|
+
jp@populuxe:~/code/ruby$ gem sources -a http://gems.github.com
|
10
|
+
jp@populuxe:~/code/ruby$ gem install jpignata-bossman
|
2
11
|
|
3
|
-
This gem provides methods to interact with Yahoo's BOSS web service.
|
data/bossman.gemspec
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "bossman"
|
3
|
-
s.version = "0.0.
|
4
|
-
s.date = "2008-08-
|
5
|
-
s.summary = "
|
3
|
+
s.version = "0.0.3"
|
4
|
+
s.date = "2008-08-14"
|
5
|
+
s.summary = "Class for interaction with the Yahoo BOSS web service."
|
6
6
|
s.email = "jpignata@waterfrontmedia.com"
|
7
7
|
s.homepage = "http://github.com/jpignata/bossman"
|
8
|
-
s.description = "Library for interaction with the Yahoo BOSS web service."
|
9
8
|
s.authors = ["John Pignata"]
|
10
9
|
s.files = ["README", "bossman.gemspec", "lib/bossman.rb"]
|
11
10
|
s.add_dependency("rails", [">= 2.1.0"])
|
data/lib/bossman.rb
CHANGED
@@ -30,7 +30,7 @@ module BOSSMan
|
|
30
30
|
options[:region] = region if region
|
31
31
|
|
32
32
|
get_from_boss(method, query, options)
|
33
|
-
|
33
|
+
end
|
34
34
|
|
35
35
|
def images_search(query, start=0, count=10, filter=nil, dimensions=nil, refererurl=nil, url=nil)
|
36
36
|
method = "images"
|
@@ -75,14 +75,18 @@ module BOSSMan
|
|
75
75
|
when Net::HTTPSuccess
|
76
76
|
return ActiveSupport::JSON.decode(response.body)["ysearchresponse"]
|
77
77
|
else
|
78
|
-
|
79
|
-
code = REXML::XPath.first(response_document, '//yahoo:code').text
|
80
|
-
description = REXML::XPath.first(response_document, '//yahoo:description').text
|
81
|
-
detail = REXML::XPath.first(response_document, '//yahoo:detail').text
|
82
|
-
raise BOSSError, "#{code} #{description}: #{detail}"
|
78
|
+
raise BOSSError, parse_error(response.body)
|
83
79
|
end
|
84
80
|
end
|
85
81
|
|
82
|
+
def parse_error(response_string)
|
83
|
+
response_document = REXML::Document.new(response_string)
|
84
|
+
code = REXML::XPath.first(response_document, '//yahoo:code').text
|
85
|
+
description = REXML::XPath.first(response_document, '//yahoo:description').text
|
86
|
+
detail = REXML::XPath.first(response_document, '//yahoo:detail').text
|
87
|
+
return "#{code} #{description}: #{detail}"
|
88
|
+
end
|
89
|
+
|
86
90
|
class MissingConfiguration < StandardError; end
|
87
91
|
class BOSSError < StandardError; end
|
88
92
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jpignata-bossman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Pignata
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-08-
|
12
|
+
date: 2008-08-14 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 2.1.0
|
23
23
|
version:
|
24
|
-
description:
|
24
|
+
description:
|
25
25
|
email: jpignata@waterfrontmedia.com
|
26
26
|
executables: []
|
27
27
|
|
@@ -58,6 +58,6 @@ rubyforge_project:
|
|
58
58
|
rubygems_version: 1.2.0
|
59
59
|
signing_key:
|
60
60
|
specification_version: 2
|
61
|
-
summary:
|
61
|
+
summary: Class for interaction with the Yahoo BOSS web service.
|
62
62
|
test_files: []
|
63
63
|
|