yahoo 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +11 -0
- data/{LICENSE → LICENSE.txt} +0 -0
- data/Manifest.txt +3 -2
- data/{README → README.txt} +0 -0
- data/Rakefile +16 -58
- data/lib/yahoo.rb +10 -12
- data/test/test_yahoo.rb +3 -3
- metadata +21 -11
data/History.txt
ADDED
data/{LICENSE → LICENSE.txt}
RENAMED
File without changes
|
data/Manifest.txt
CHANGED
data/{README → README.txt}
RENAMED
File without changes
|
data/Rakefile
CHANGED
@@ -1,69 +1,27 @@
|
|
1
|
-
require '
|
2
|
-
require 'rake'
|
3
|
-
require 'rake/testtask'
|
4
|
-
require 'rake/rdoctask'
|
5
|
-
require 'rake/gempackagetask'
|
1
|
+
require 'hoe'
|
6
2
|
|
7
|
-
|
3
|
+
require './lib/yahoo'
|
8
4
|
|
9
|
-
|
10
|
-
s.name = 'yahoo'
|
11
|
-
s.version = '1.1.0'
|
12
|
-
s.summary = 'Base for Yahoo web services'
|
13
|
-
s.description = 'This library makes it easy to implement Yahoo\'s web services APIs.'
|
14
|
-
s.author = 'Eric Hodel'
|
15
|
-
s.email = 'eric@robotcoop.com'
|
5
|
+
DEV_DOC_PATH = 'Libraries/yahoo'
|
16
6
|
|
17
|
-
|
18
|
-
|
19
|
-
|
7
|
+
hoe = Hoe.new 'yahoo', Yahoo::VERSION do |p|
|
8
|
+
p.summary = 'Base for Yahoo web services'
|
9
|
+
p.description = 'This library makes it easy to implement Yahoo\'s web services APIs.'
|
10
|
+
p.author = 'Eric Hodel'
|
11
|
+
p.email = 'drbrain@segment7.net'
|
12
|
+
p.url = "http://dev.robotcoop.com/#{DEV_DOC_PATH}"
|
13
|
+
p.changes = File.read('History.txt').scan(/\A(=.*?)^=/m).first.first
|
14
|
+
p.rubyforge_name = 'rctools'
|
20
15
|
|
21
|
-
|
16
|
+
p.extra_deps << ['rc-rest', '>= 2.0.0']
|
22
17
|
end
|
23
18
|
|
24
|
-
|
25
|
-
task :default => [ :test ]
|
19
|
+
SPEC = hoe.spec
|
26
20
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
t.pattern = 'test/test_*.rb'
|
31
|
-
t.verbose = true
|
21
|
+
begin
|
22
|
+
require '../tasks'
|
23
|
+
rescue LoadError
|
32
24
|
end
|
33
25
|
|
34
|
-
desc 'Update Manifest.txt'
|
35
|
-
task :update_manifest do
|
36
|
-
sh "find . -type f | sed -e 's%./%%' | egrep -v 'svn|swp|~' | egrep -v '^(doc|pkg)/' | sort > Manifest.txt"
|
37
|
-
end
|
38
|
-
|
39
|
-
desc 'Generate RDoc'
|
40
|
-
Rake::RDocTask.new :rdoc do |rd|
|
41
|
-
rd.rdoc_dir = 'doc'
|
42
|
-
rd.rdoc_files.add 'lib', 'README', 'LICENSE'
|
43
|
-
rd.main = 'README'
|
44
|
-
rd.options << '-d' if `which dot` =~ /\/dot/
|
45
|
-
rd.options << '-t Yahoo Web Services'
|
46
|
-
end
|
47
|
-
|
48
|
-
desc 'Generate RDoc for dev.robotcoop.com'
|
49
|
-
Rake::RDocTask.new :dev_rdoc do |rd|
|
50
|
-
rd.rdoc_dir = '../../../www/trunk/dev/html/Libraries/yahoo'
|
51
|
-
rd.rdoc_files.add 'lib', 'README', 'LICENSE'
|
52
|
-
rd.main = 'README'
|
53
|
-
rd.options << '-d' if `which dot` =~ /\/dot/
|
54
|
-
rd.options << '-t Yahoo Web Services'
|
55
|
-
end
|
56
|
-
|
57
|
-
desc 'Build Gem'
|
58
|
-
Rake::GemPackageTask.new spec do |pkg|
|
59
|
-
pkg.need_tar = true
|
60
|
-
end
|
61
|
-
|
62
|
-
desc 'Clean up'
|
63
|
-
task :clean => [ :clobber_rdoc, :clobber_package ]
|
64
|
-
|
65
|
-
desc 'Clean up'
|
66
|
-
task :clobber => [ :clean ]
|
67
|
-
|
68
26
|
# vim: syntax=Ruby
|
69
27
|
|
data/lib/yahoo.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'rubygems'
|
1
2
|
require 'rc_rest'
|
2
3
|
|
3
4
|
##
|
@@ -7,6 +8,11 @@ require 'rc_rest'
|
|
7
8
|
|
8
9
|
class Yahoo < RCRest
|
9
10
|
|
11
|
+
##
|
12
|
+
# This is the version of Yahoo you are using.
|
13
|
+
|
14
|
+
VERSION = '1.1.1'
|
15
|
+
|
10
16
|
##
|
11
17
|
# Yahoo error class.
|
12
18
|
|
@@ -24,32 +30,24 @@ class Yahoo < RCRest
|
|
24
30
|
# +host+:: API endpoint hostname
|
25
31
|
# +service_name+:: service name
|
26
32
|
# +version+:: service name version number
|
27
|
-
# +method+:: service method call
|
28
33
|
#
|
29
34
|
# See http://developer.yahoo.com/search/rest.html
|
30
35
|
|
31
36
|
def initialize(appid)
|
32
37
|
@appid = appid
|
33
|
-
@url = URI.parse "http://#{@host}/#{@service_name}/#{@version}
|
38
|
+
@url = URI.parse "http://#{@host}/#{@service_name}/#{@version}/"
|
34
39
|
end
|
35
40
|
|
36
|
-
|
37
|
-
# Extracts and raises an error from +xml+, if any.
|
38
|
-
|
39
|
-
def check_error(xml)
|
41
|
+
def check_error(xml) # :nodoc:
|
40
42
|
err = xml.elements['Error']
|
41
43
|
raise Error, err.elements['Message'].text if err
|
42
44
|
end
|
43
45
|
|
44
|
-
|
45
|
-
# Creates a URL from the Hash +params+. Automatically adds the appid and
|
46
|
-
# sets the output type to 'xml'.
|
47
|
-
|
48
|
-
def make_url(params)
|
46
|
+
def make_url(method, params) # :nodoc:
|
49
47
|
params[:appid] = @appid
|
50
48
|
params[:output] = 'xml'
|
51
49
|
|
52
|
-
super params
|
50
|
+
super method, params
|
53
51
|
end
|
54
52
|
|
55
53
|
end
|
data/test/test_yahoo.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'test/unit'
|
2
|
+
require 'rubygems'
|
2
3
|
require 'rc_rest/uri_stub'
|
3
4
|
require 'yahoo'
|
4
5
|
|
@@ -8,12 +9,11 @@ class Yahoo::Test < Yahoo
|
|
8
9
|
@host = 'api.test.yahoo.com'
|
9
10
|
@service_name = 'TestService'
|
10
11
|
@version = 'Vtest'
|
11
|
-
@method = 'test'
|
12
12
|
super
|
13
13
|
end
|
14
14
|
|
15
15
|
def test
|
16
|
-
get :test_param => 5
|
16
|
+
get :test, :test_param => 5
|
17
17
|
end
|
18
18
|
|
19
19
|
def parse_response(xml)
|
@@ -43,7 +43,7 @@ class TestYahoo < Test::Unit::TestCase
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def test_make_url
|
46
|
-
url = @t.make_url :param => 'value'
|
46
|
+
url = @t.make_url :test, :param => 'value'
|
47
47
|
|
48
48
|
expected = 'http://api.test.yahoo.com/TestService/Vtest/test?appid=APP_ID&output=xml¶m=value'
|
49
49
|
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.
|
2
|
+
rubygems_version: 0.9.0.6
|
3
3
|
specification_version: 1
|
4
4
|
name: yahoo
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.1.
|
7
|
-
date: 2006-
|
6
|
+
version: 1.1.1
|
7
|
+
date: 2006-11-27 00:00:00 -08:00
|
8
8
|
summary: Base for Yahoo web services
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
|
-
email:
|
12
|
-
homepage:
|
13
|
-
rubyforge_project:
|
11
|
+
email: drbrain@segment7.net
|
12
|
+
homepage: http://dev.robotcoop.com/Libraries/yahoo
|
13
|
+
rubyforge_project: rctools
|
14
14
|
description: This library makes it easy to implement Yahoo's web services APIs.
|
15
15
|
autorequire:
|
16
16
|
default_executable:
|
@@ -29,14 +29,15 @@ post_install_message:
|
|
29
29
|
authors:
|
30
30
|
- Eric Hodel
|
31
31
|
files:
|
32
|
-
-
|
32
|
+
- History.txt
|
33
|
+
- LICENSE.txt
|
33
34
|
- Manifest.txt
|
34
|
-
- README
|
35
|
+
- README.txt
|
35
36
|
- Rakefile
|
36
37
|
- lib/yahoo.rb
|
37
38
|
- test/test_yahoo.rb
|
38
|
-
test_files:
|
39
|
-
|
39
|
+
test_files:
|
40
|
+
- test/test_yahoo.rb
|
40
41
|
rdoc_options: []
|
41
42
|
|
42
43
|
extra_rdoc_files: []
|
@@ -48,6 +49,15 @@ extensions: []
|
|
48
49
|
requirements: []
|
49
50
|
|
50
51
|
dependencies:
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: hoe
|
54
|
+
version_requirement:
|
55
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 1.1.4
|
60
|
+
version:
|
51
61
|
- !ruby/object:Gem::Dependency
|
52
62
|
name: rc-rest
|
53
63
|
version_requirement:
|
@@ -55,5 +65,5 @@ dependencies:
|
|
55
65
|
requirements:
|
56
66
|
- - ">="
|
57
67
|
- !ruby/object:Gem::Version
|
58
|
-
version:
|
68
|
+
version: 2.0.0
|
59
69
|
version:
|