The encode_base64 method is not defined until Example 2-10 (Utility Methods), but I neglected to mention this correctly at this point in the chapter. Sorry about that.
You can either skip ahead to Example 2-10 to find the full implementation of this method, or you can temporary replace the call to the encode_base64 method with the following:
b64_sig = Base64.encode64(digest)
We added the encode_base64 method relatively late in the development of the book, after we discovered that the default Ruby base 64 encoding method (as listed above) adds newline characters to the result. These characters cause issues for the Amazon services discussed later in the book. I intended to add a reference to Example 2-10 before the test script listing, but this line mistakenly refers to Example 2-2.
Thanks for reporting the issue. I hope this explanation and work-around helps.
Regards,
James
P.S. Don't forget that all the example code is available for download, to save you typing it all out. You can find the code archive here:
http://examples.oreilly.com/9780596515812/
This post has been edited by James Murty: 28 March 2009 - 07:29 PM