Created
August 25, 2010 21:25
-
-
Save ecito/550330 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
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