Skip to content

Instantly share code, notes, and snippets.

@ecito
Created August 25, 2010 21:25
Show Gist options
  • Select an option

  • Save ecito/550330 to your computer and use it in GitHub Desktop.

Select an option

Save ecito/550330 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'httparty'
require 'json'
class Party
include HTTParty
base_uri 'messageparty.net'
def post room, message
headers = {
"User-Agent" => "MessageParty/1.0 CFNetwork/485.2 Darwin/10.3.1",
"Content-Type" => "application/json",
"Accept" => "application/json",
"Accept-Language" => "en-us",
}
body = {
"roommessage" => {
"room_id" => "#{room}",
"imgurl" => "http://www.digyourowngrave.com/content/antoine_dodson.jpg",
"text" => message,
"user_id" => "1130",
"displayname" => "Antoine D"
}
}
options = { :body => body.to_json, :headers => headers}
response = self.class.post('/roommessages.json', options)
puts response.inspect
end
end
Party.new.post(1083, "You don't have to come, and confess, we looking for you")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment