Ruby/AWS Released

I’m coding again and it feels good.

The only serious coding I’d done since leaving Google was tv_grab_nl_upc, an XMLTV Dutch TV programme guide data grabber for use with MythTV. It’s a decent piece of code, but it hasn’t exactly found a wide audience.

One of my most popular projects of all time has undoubtedly been Ruby/Amazon, a Ruby interface to Amazon’s Associate Web Service. Ruby/Amazon was originally written and released in 2004 as an autodidactic exercise for me to gain experience with programming for Web services.

It was written for Amazon’s AWS v3 API. Amazon announced soon after the release of Ruby/Amazon that it would soon be launching AWS v4, but would continue to maintain the AWS v3 interface until further notice. That notice came in the first half of 2007, when Amazon announced that it would finally shut down access to the AWS v3 API on 31st March 2008.

Close to a year’s notice would have given a normal person ample time to work on upgrading his code to use the new API, but I’m no mere normal person, so the code predictably continued to gather moss under my custodianship.

I did finally do some significant work on rewriting the library for AWS v4 while Sarah and Eloïse were in Chicago for a few weeks last summer, but once they had returned, the code stagnated again. By the time I’d found my latent coding stride — something I can only work up to in relative solitude — the house became a hive of activity once more.

The unavailability of that state of solitude, a state I find essential in order to foster concentration deep enough to produce quality code, has, as far as I’m concerned, been the most debilitating aspect of parenthood. If I’d had an office five minutes’ walk from here, that would have been enough to solve the problem, but being in the same house has proved, for me, to be too big a distraction.

Nevertheless, for whatever reason, in the last ten days of March this year, I was suddenly gripped by the urge to get working on the library again and knock out a working version for AWS v4 before the AWS v3 shut-down deadline at the end of March.

Version 0.0.1 of Ruby/AWS, the sequel to Ruby/Amazon, finally saw the light of day on 24th March. The code was ugly — embarrassingly so — and was publicly released for the sole reason of providing Ruby/Amazon users with a migration path to the new API. Yes, I should have given people more than a week to migrate — I should have done this work two years ago — but at least I didn’t leave them completely in the lurch.

Why the name change to Ruby/AWS? At the time, AWS was the only Amazon Web API, so it made sense to call my Ruby interface to it Ruby/Amazon. In the intervening years, however, AWS has become just one of many Amazon Web APIs. Therefore, it’s more accurate to call the new library Ruby/AWS. An even better name might be Ruby/Amazon/AWS. Take your pick.

Ruby/Amazon has, in some ways, been my most successful piece of code to date. Not only was it downloaded and used by a lot of people, but it also scored me an opportunity to write about my own software for an issue of Dr. Dobbs’ Journal a few years ago. Writing an article for a serious publication is always great, but writing about your own code is even more enjoyable.

Over the last three years, I’ve had many questions about updating the library for AWS v4 and even an offer of paid contract work to do it, but the motivation has always sadly been lacking. Then, suddenly, with the arrival of Lucas mere days away, I was suddenly possessed by the urge to do the right thing and not just let the code fade into oblivion. I suppose I needed the boost to my self-esteem, because a decent amount of my self-respect is derived from my intellectual muscle, if you will; muscles that have atrophied and become a bit flabby in recent times.

I was also spurred on by the increasing number of mails I was receiving as the end of March deadline approached, most of which basically said, ‘Help, my code is about top stop working.’ I felt a certain obligation to my users not to leave them out in the cold. For whatever reason, people weren’t entirely content with the other projects that had sprung up to fill the vacuum in recent years.

Anyway, yesterday saw the release of version 0.1.0 of Ruby/AWS, a version that no longer causes me embarrassment. It doesn’t (yet) support the full v4 API, but it’s pretty good at what it does.

What it does is ItemSearch, ItemLookup, SellerListingSearch, BrowseNodeLookup and ListSearch. It also supports batch requests and (as of 0.1.0) multiple operations.

Conspicuous by its absence is support for remote shopping carts. This will come later.

Version 0.1.0 has a new recursive XML parser that dynamically creates classes and instantiates objects from them on demand. This is an improvement from versions 0.0.1 and 0.0.2, as well as from Ruby/Amazon, which were all only semi-dynamic in their class definition. This one change allowed me to ditch most of the work I did last summer, which involved manually defining a large number of classes to match the data sets that could be returned by the API.

Anyway, it does feel good to have produced a new piece of code. Almost no code from Ruby/Amazon was recycled in the process, because the v3 and v4 APIs are totally different.

This Web site is already running the new code to display links to Amazon products in the left sidebar and Ruby/AWS has already been placed in the Fedora distribution (releases 7 and later), replacing the now obsolete Ruby/Amazon.

If you need programmatic access to Amazon, Ruby/AWS may be your thing.

This entry was posted in Ruby. Bookmark the permalink.

7 Responses to Ruby/AWS Released

  1. justin says:

    Hi,

    I quickly checked out the ruby/aws library. It seems that all the results pages only contain a single result. At least in the examples. Just wanted to let you know.

    -Justin

  2. shawn says:

    Hi Ian, thanks for the hard work.

    Is there a ruby gem? Is it ruby-aws?

    Thank you,

    -s

  3. Justin,

    I haven’t seen the problem you describe? Are you still seeing it with version 0.3.0?

    Shawn,

    I haven’t made a gem yet, as I’ve never made one before and don’t yet know how.

    Ruby/AWS shouldn’t be confused with the identically named project on RubyForge. That’s an entirely different project and doesn’t seem to do anything with the AWS API at all. It seems to be named AWS, because it deals with some of the Amazon Web Service APIs, but AWS also stands for Associates Web Service, which is just one of Amazon’s Web APIs. Very confusing, I know.

  4. alan says:

    I’m really uncomfortable with this install procedure … I feel completely out of control. At least with a gem I know I can just $ gem uninstall it (and moreover I can vendor the gem in my projects to keep things extra clean). Please make this a gem or plugin as soon as possible.

    Also, although you may have moral rights to the name, I really urge you to change it to differentiate from that other project. It has been a massively confusing process trying to figure out what to install to get access to Amazon product info. I almost gave up.

    A distinctive name and a gem would make this project much more friendly and, I would guess, popular.

    Cheers all the same though :o)

  5. Hi Alan,

    What do you mean by “vendor the gem”?

    I’ll try to make Ruby/AWS into a gem soon. As I’ve said, I haven’t made one before and time is scarce, so it’s always too tempting to work on the code instead of learning a new packaging system.

    Ruby/AWS is becoming quite mature at this stage, however. Most, if not all, of the AWS API is now supported and the interfaces have settled down. Perhaps I’ll move it to beta status soon.

    That will leave more time to learn about gems, a subject on which I am admittedly hopelessly behind.

  6. alan says:

    Sorry Ian, I always think Rails but never Ruby. In Rails you can specify what gems your app depends on. Then you can run a rake task which will unpack the required gems to you vendor/gems directory (aka vendoring), freeing you from the need for the gems to be installed on the system at all.

    Rather than install your code on my system I just hacked the ‘requires’ and copied it all into my apps lib directory. It works and it means I can completely remove the code at a click if I wish which makes me happy.

    Cheers.

  7. As of version 0.3.3, Ruby/AWS is available as a gem.

    Thanks for pushing me to do the work on this.

Leave a Reply

Your email address will not be published. Required fields are marked *