Created
February 3, 2009 14:04
-
-
Save jamesu/57531 to your computer and use it in GitHub Desktop.
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
## | |
# 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