A new Ruby gem for the Readernaut API

I was so happy to discover Readernaut this weekend. It’s got a lot of features and the interface seems much more intuitive than Shelfari or Good Reads. Since John Nunemaker’s HTTParty makes writing API wrappers in Ruby so much fun, I knocked out readernaut.

Installation

sudo gem install gemcutter
gem tumble
sudo gem install readernaut

Usage

# get a list of books for a user
books = Readernaut.books("pengwynn")
books.reader_books.first.book_edition.title
=> "Crush It!"

# get a list of notes for a user
notes = Readernaut.notes("pengwynn")

# get a list of contacts for a user
contacts = Readernaut.contacts("pengwynn").contacts
contacts.last.user.username
=> "blankenship"

# paginate, ordering
books = Readernaut.books("pengwynn", :page => 3, :order_by => "modified")
# descending
books = Readernaut.books("pengwynn", :page => 3, :order_by => "-modified")

So, what are you reading? Why not friend me and recommend something.

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Related posts:

  1. Link LinkedIn into your next Ruby application
  2. New in the Twitter gem: Lists!
  3. What makes a good API wrapper?
  4. New in TwitterLand: TweetMeme and Foller.me API support
  5. Plan your Nextstop from Ruby — or Twitter!
Bookmark the permalink. Both comments and trackbacks are currently closed.
  • Good job! :)
  • pie
    May I recommend changing the #books method? It doesn't feel very semantic to me. To me, it feels like an array would be inputted. It's an extra piece of code but Readernaut.user('pengwynn').books feels a lot more semantic. The to_s could return the url at the very least if you don't have anything else to return.
  • I can see your point. In this case I pretty much stuck with the API as-is. In an upcoming post I'll be covering API wrapper approaches and the virtues of being more language idiomatic vs. sticking with the API. I look forward to your comments on that one while I tinker with your idea here.
blog comments powered by Disqus