diff options
author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-09-24 15:18:44 +0000 |
---|---|---|
committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-09-24 15:18:44 +0000 |
commit | db9445103c082a306ba085f7677da02ea94b8841 (patch) | |
tree | a311d59f031ae5def87f68be71ed1f58abadc031 /sample/wsdl/amazon/wsdlDriver.rb | |
parent | 8c2fb77787d1f20b4c19c9c52552856c339b86e9 (diff) |
* lib/soap/* (29 files): SOAP4R added.
* lib/wsdl/* (42 files): WSDL4R added.
* lib/xsd/* (12 files): XSD4R added.
* test/soap/* (16 files): added.
* test/wsdl/* (2 files): added.
* test/xsd/* (3 files): added.
* sample/soap/* (27 files): added.
* sample/wsdl/* (13 files): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/wsdl/amazon/wsdlDriver.rb')
-rw-r--r-- | sample/wsdl/amazon/wsdlDriver.rb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/sample/wsdl/amazon/wsdlDriver.rb b/sample/wsdl/amazon/wsdlDriver.rb new file mode 100644 index 0000000000..baf55a4968 --- /dev/null +++ b/sample/wsdl/amazon/wsdlDriver.rb @@ -0,0 +1,48 @@ +require 'soap/wsdlDriver' + +book = ARGV.shift || "Ruby" + +# AmazonSearch.rb is generated from WSDL. +# Run "wsdl2ruby.rb --wsdl http://soap.amazon.com/schemas2/AmazonWebServices.wsdl --classDef --force" +require 'AmazonSearch.rb' + +=begin +Or, define the class by yourself like this. + +class KeywordRequest + def initialize(keyword = nil, + page = nil, + mode = nil, + tag = nil, + type = nil, + devtag = nil, + sort = nil) + @keyword = keyword + @page = page + @mode = mode + @tag = tag + @type = type + @devtag = devtag + @sort = sort + end +end +=end + +# You must get 'developer's token" from http://associates.amazon.com/exec/panama/associates/ntg/browse/-/1067662 to use Amazon Web Services 2.0. +#devtag = File.open(File.expand_path("~/.amazon_key")).read.chomp + +AMAZON_WSDL = 'http://soap.amazon.com/schemas2/AmazonWebServices.wsdl' +amazon = SOAP::WSDLDriverFactory.new(AMAZON_WSDL).create_driver +p "WSDL loaded" +amazon.generate_explicit_type = true +#amazon.wiredump_dev = STDERR + +# Show sales rank. +req = KeywordRequest.new(book, "1", "books", "webservices-20", "lite", devtag, "+salesrank") +amazon.KeywordSearchRequest(req).Details.each do |detail| + puts "== #{detail.ProductName}" + puts "Author: #{detail.Authors.join(", ")}" + puts "Release date: #{detail.ReleaseDate}" + puts "List price: #{detail.ListPrice}, our price: #{detail.OurPrice}" + puts +end |