October 06, 2007

Posted by John

Tagged api, bookmarking, gems, magnolia, and web services

Older: Easy Edge Rails Deployment

Newer: RubyConf and Miscellany

Mirrored: A Del.icio.us and Ma.gnolia API

Magnolia
Delicious

Ma.gnolia announced quite some time ago that they had a mirrored api that worked identically to the Del.icio.us api in an effort to make it easier for Del.icio.us add-on/tool creators to make things that worked with Ma.gnolia as well. I thought it was a smart move. Last night, I was in the mood to code, so I put together a gem that wraps that mirrored api (even though I already have a gem for magnolia).

Now, it doesn’t matter which of the social bookmarking sites you use. Either way you have a nice, easy to use ruby api. I thought this might help some of those mashup creators out there. Simply, use mirrored and you can support two social bookmarking sites for the price of one. Pretty cool, eh?

Usage

I’m a huge fan of Active Record so most of my gems have a similar feel thought each is written a bit differently internally. First, install the gem:

sudo gem install mirrored

Now you can reap the benefits of my toil like so:

require 'rubygems'
require 'mirrored'
require 'pp'

# you can use :delicious or :magnolia as the service for the first parameter
Mirrored::Base.establish_connection(:magnolia, 'jnunemaker', 'password')

# this would print all my most recent magnolia posts tagged ruby
pp Mirrored::Post.find(:recent, :tag => 'ruby')

There is a lot more you can do with mirrored, so check out the rubyforge page and the documentation.

3 Comments

  1. Hello there John,

    is it possible to retrieve all public posts by a particular user without authenticating first? Basically like integrating users’ public del.icio.us posts into their site on another web application…

    -J

  2. @Jorg – Not with my gem. I have seen this done on other sites but haven’t looked into how it’s done. Might just use rss feed.

  3. Hey there,

    thanks for the reply :)

    ah well ok… I’ll look elsewhere and maybe I can provide a patch that allows optional, password-less datafetching. Forked it at github and we’ll see how it turns out :)

    -J

Sorry, comments are closed for this article to ease the burden of pruning spam.

About

Authored by John Nunemaker (Noo-neh-maker), a programmer who has fallen deeply in love with Ruby. Learn More.

Projects

Flipper
Release your software more often with fewer problems.
Flip your features.