You can use a simple web server for example WEBrick to listen certain port. Ruby code would be(http://www.ruby-doc.org/stdlib-2.0/libdoc/webrick/rdoc/WEBrick.html):
require 'webrick'
server = WEBrick::HTTPServer.new :Port => 8000
trap 'INT' do server.shutdown end
server.start
Then you can take request and do whatever you want with the data sent:
server.mount_proc '/' do |req, res|
do_what_you_want(req)
res.status = 200
res.body = 'OK'
end