Skip to content

Instantly share code, notes, and snippets.

@madmimi
Created January 5, 2010 22:06
Show Gist options
  • Save madmimi/269783 to your computer and use it in GitHub Desktop.
Save madmimi/269783 to your computer and use it in GitHub Desktop.
post to Campfire via new API
require 'httparty'
require 'json'
class Campfire
include HTTParty
base_uri 'https://YOUR_DOMAIN.campfirenow.com'
basic_auth 'YOUR_API_KEY', 'X' # yes, that is a literal X string. it's needed to satisfy basic_auth(), but campfire ignores it.
headers 'Content-Type' => 'application/json'
def self.speak(message)
body = {
:message => {
:type => 'TextMessage',
:body => message
}
}.to_json
post('/room/YOUR_ROOM_ID/speak.json', {:body => body})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment