Tuesday, November 14, 2006

Ruby and Amazon Web Services

I've been ill at home for the last few days, but today I felt well enough to play a little. I built a really useful little command line application in Ruby. It's already saved the time it took to write it.

It expects to find an ISBN in the clipboard. It checks that the ISBN is valid, uses the Amazon Web Service interface to get book details from an ISBN, and pastes the details to the clipboard, complete with an Amazon affiliate link. (If you buy the book after clicking on the link, I get a little money).

A variant does the same thing, but copies the book details in a format ready to paste into TiddlyWiki which I use as an personal blog/wiki.

I found out how to parse XML in Ruby by reading Enterprise Integration with Ruby. (You can guess how I created that link, can't you?)

Here's the Ruby code. To use it you will have to sign up for Amazon web services (if you haven't done so) and insert your access key into the code.

Ruby rocks.

No comments: