opensoul.org

Tinder: Campfire API

December 8, 2006 popular , code 2 min read

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](http://www.tutorials.com/04/0438/04383.asp)

This content is open source. Suggest Improvements.

@bkeepers

avatar of Brandon Keepers I am Brandon Keepers, and I work at GitHub on making Open Source more approachable, effective, and ubiquitous. I tend to think like an engineer, work like an artist, dream like an astronaut, love like a human, and sleep like a baby.