Skip to content

Instantly share code, notes, and snippets.

@jamesu
Created February 3, 2009 14:04
Show Gist options
  • Save jamesu/57531 to your computer and use it in GitHub Desktop.
Save jamesu/57531 to your computer and use it in GitHub Desktop.
##
# Posting stuff to EchoWaves using httparty
#
# Note: protect_from_forgery needs to be disabled
##
require 'httparty'
class Echowaves
include HTTParty
base_uri "http://localhost:3000"
basic_auth "localhost", "password"
def conversations
get('/conversations.xml')
end
# post message
def message(cid, content)
post("/conversations/#{cid}/messages.json", {'message' => content})
end
end
# Examples:
Echowaves.message(Echowaves.conversations[0]['id'], 'Hello world!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment