So, the Amazon Product Advertising API (formerly known as Amazon E-Commerce API, formerly known as just Amazon Web Services back when it was the only one) will require a cryptographic signature on all requests in order to use it, after August 15th.
Here’s some ruby code to do that for you. Requires the ruby hmac gem.
Not really very much code, but does anyone think I should turn it into a free-standing gem? If so, anyone want to tell me how to do that? And, for non-Rails-specific gems, what’s the current best practice as far as what framework to use for included unit tests?
Oh, and even though it’s not very much code, it would have been a pain to figure out if I hadn’t just copied it from Chris Roos, thanks Chris! The only issue with Chris’s code is it didn’t properly escape input before generating a signature according to Amazon’s specs; perhaps this wasn’t an issue with the sort of input you’d generally have with whatever other (not Product Advertising API) services Chris actually wrote his code for (or maybe those other Amazon services actually had a different escaping spec).