Tinder: Campfire API

api | campfire | ruby | tinder December 08 2006

update: Tinder can listen

update: Tinder is now available as a gem from rubyforge. Check out http://rubyforge.org/projects/tinder for more information.

For a project that I’m currently working, the client wants to be able provide live chat to its users. So, instead of re-inventing the wheel, we decided to try to use Campfire. The only problem is that I need to be able to create and destroy chat rooms automatically, and Campfire doesn’t have an API.

Caboo.se has done some work on a Campfire bot called Marshmallow but the code repository is unavailable. And, it doesn’t seem to allow you to create and delete rooms.

So, introducing Tinder, an API for interfacing with Campfire:

require 'rubygems'
require 'tinder'
campfire = Tinder::Campfire.new 'mysubdomain'
campfire.login 'myemail@example.com', 'mypassword'
room = campfire.create_room 'New Room', 'My new campfire room to test tinder'
room.speak 'Hello world!'
room.paste File.read("path/to/your/file.txt")
room.destroy

Install

gem install tinder

You can get the source from:

git clone git://github.com/collectiveidea/tinder.git

Tinder can also be installed as a gem or a rails plugin.

script/plugin install git://github.com/collectiveidea/tinder.git

Thanks to Zach Dennis for the name. Feedback and patches are welcome!

Tinder
image courtesy of Tutorials.com

posted by brandon | updated June 19th 07:27 PM
comments feed

3 comments

  1. I’m very curious to see how far you can get with this. I’ve been waiting and waiting for 37s to do an API to Campfire but I think they are tied up with other things (like Sunrise and getting Rails 1.2 out the door).

    Keep going I say :-)

    Mark Haliday Mark Haliday
    December 09, 2006 at 12:11 AM
  2. Contributions would be appreciated :) It pretty much does all that I needed it to do (login, create rooms, destroy rooms) for the project I wrote it for, but it would be cool to make it a full featured “API”.

    Brandon Brandon
    December 09, 2006 at 09:26 AM
  3. Hey man. You’re linked up on the campfire homepage.

    Cool beans!

    AJP AJP
    February 22, 2007 at 11:08 AM

About

I'm Brandon Keepers, a web application developer that likes beautiful code, valid markup and adherence to standards. As a part of Collective Idea in Holland, Michigan, I practice Agile software development primarily using Ruby on Rails.

-86.103171 42.785037

Contact:

more ยป

Syndicate