Created
January 5, 2010 22:06
-
-
Save madmimi/269783 to your computer and use it in GitHub Desktop.
post to Campfire via new API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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