Class: MSG_Chumby::TimeHandler

Inherits:
Mongrel::HttpHandler
  • Object
show all
Defined in:
lib/msg-chumby-daemon/http-xml-server.rb

Instance Method Summary collapse

Instance Method Details

#process(request, response) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/msg-chumby-daemon/http-xml-server.rb', line 10

def process(request, response)
  response.start(200) do |head,out|
  #  puts "Request for time received."
    head["Content-Type"] = "text/xml"
    current_time={'time' => [ Time.now.strftime("%H:%M:%S")], 'counter' => [$counter]}
    out.write(XmlSimple.xml_out( current_time,{'RootName' => "current_time"}));
    $counter+=1
  end
end