Skip to content

Instantly share code, notes, and snippets.

@audionerd
Created December 29, 2010 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save audionerd/758306 to your computer and use it in GitHub Desktop.
Save audionerd/758306 to your computer and use it in GitHub Desktop.
diff --git a/chapter_09/soap/amazon_search_wsdl.rb b/chapter_09/soap/amazon_search_wsdl.rb
index 53af668..a2e0cf7 100644
--- a/chapter_09/soap/amazon_search_wsdl.rb
+++ b/chapter_09/soap/amazon_search_wsdl.rb
@@ -1,4 +1,3 @@
-require 'rubygems'
require 'savon'
require 'hmac'
require 'hmac-sha2'
@@ -9,7 +8,9 @@ class AmazonProductAdvertisingAPI
def initialize(aws_access_key_id, aws_secret_key)
@aws_access_key_id = aws_access_key_id
@aws_secret_key = aws_secret_key
- @client = Savon::Client.new("http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl")
+ @client = Savon::Client.new do |wsdl|
+ wsdl.document = "http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl"
+ end
end
def timestamp_and_signature(operation)
@@ -26,8 +27,8 @@ class AmazonProductAdvertisingAPI
def search(query)
operation = "ItemSearch"
timestamp, signature = timestamp_and_signature(operation)
-
- @client.item_search do |soap|
+
+ @client.request :item_search do |soap|
soap.body = {
"SearchIndex" => "Books",
"Keywords" => query,
@@ -42,8 +43,10 @@ end
aws_access_key_id = ENV["AWS_ACCESS_KEY_ID"]
aws_secret_key = ENV["AWS_SECRET_KEY"]
-Savon::Request.log = false
+Savon.configure do |config|
+ config.log = false # disable logging
+end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment