2003-09-24 11:18:44 -04:00
|
|
|
require 'soap/wsdlDriver'
|
|
|
|
|
|
|
|
book = ARGV.shift || "Ruby"
|
|
|
|
|
|
|
|
# AmazonSearch.rb is generated from WSDL.
|
2003-10-03 13:15:23 -04:00
|
|
|
# Run "wsdl2ruby.rb --wsdl http://soap.amazon.com/schemas3/AmazonWebServices.wsdl --classdef --force"
|
|
|
|
# http://soap.amazon.com/schemas3/AmazonWebServices.wsdl
|
2003-09-24 11:18:44 -04:00
|
|
|
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.
|
* lib/soap/**/*.rb, lib/wsdl/**/*.rb, lib/xsd/**/*.rb: changed license; GPL2 -> Ruby's.
* lib/soap/rpc/driver.rb, lib/soap/wsdlDriver.rb, lib/soap/streamHandler.rb: add interface to streamhandler.
* lib/soap/marshal.rb: raise error if parse fails.
* lib/soap/netHttpClient.rb: add https support. Patched by Oliver M. Bolzer.
* lib/soap/netHttpClient.rb: dump HTTP response message body by itself.
* lib/soap/rpc/driver.rb, lib/soap/rpc/proxy.rb, lib/soap/wsdlDriver.rb: add driver#mandatorycharset interface to foce using charset for parsing response from buggy server.
* lib/soap/encodingstyle/soapHandler.rb: support Apache Axis's half typed multi-ref array.
* lib/soap/mapping/factory.rb, lib/soap/mapping/registry.rb: map SOAPStruct which has multi-accessors which name are the same, to an array.
* lib/soap/rpc/element.rb: fixed illegal parameter order.
* lib/soap/rpc/element.rb: element name of response message could have the name other than 'return'.
* lib/wsdl/operation.rb, lib/wsdl/operationBinding.rb, lib/wsdl/soap/classDefCreator.rb, lib/wsdl/soap/methodDefCreator.rb, lib/wsdl/soap/methodDefCreatorSupport.rb: WSDL/1.1 allows plural fault definition in a operation. [ruby-talk:84948]
* test/wsdl/multiplefault.wsdl, test/wsdl/test_multiplefault.rb: add test for above fix.
* lib/wsdl/soap/complexType.rb: support WSDL array definition with maxOccures="unbound".
* lib/xsd/charset.rb: use cp932 under emx. Patched by Siena. / SHINAGAWA, Norihide in [ruby-dev:21972]
* lib/xsd/xmlparser/parser.rb: set @charset nil by default. Nil means 'follow encoding declaration in XML'.
* sample/soap/digraph.rb, sample/wsdl/amazon/wsdlDriver.rb, sample/wsdl/googleSearch/sampleClient.rb, sample/wsdl/googleSearch/wsdlDriver.rb, test/wsdl/test_emptycomplextype.rb, test/wsdl/marshal/test_wsdlmarshal.rb, test/xsd/test_xmlschemaparser.rb: use File.open(...) { |f| f.read } instead of File.open(...).read. [ruby-dev:21964]
* test/wsdl/emptycomplextype.wsdl, test/wsdl/test_emptycomplextype.rb: simplify the test case.
* test/wsdl/axisArray/*: add tests for axis's array encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-25 02:31:33 -05:00
|
|
|
#devtag = File.open(File.expand_path("~/.amazon_key")) { |f| f.read }.chomp
|
2003-09-27 06:14:04 -04:00
|
|
|
devtag = nil
|
2003-09-24 11:18:44 -04:00
|
|
|
|
2003-10-03 13:15:23 -04:00
|
|
|
# v2: AMAZON_WSDL = 'http://soap.amazon.com/schemas2/AmazonWebServices.wsdl'
|
|
|
|
AMAZON_WSDL = 'http://soap.amazon.com/schemas3/AmazonWebServices.wsdl'
|
2003-09-24 11:18:44 -04:00
|
|
|
amazon = SOAP::WSDLDriverFactory.new(AMAZON_WSDL).create_driver
|
|
|
|
p "WSDL loaded"
|
|
|
|
amazon.generate_explicit_type = true
|
2003-11-28 00:53:16 -05:00
|
|
|
amazon.mandatorycharset = 'utf-8' # AWS should fix this bug.
|
2003-09-24 11:18:44 -04:00
|
|
|
#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
|