Class: MSG_Chumby::HTTP_XML_Server

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

Instance Method Summary collapse

Constructor Details

#initialize(host, port, reading_cache, boundaries) ⇒ HTTP_XML_Server

Returns a new instance of HTTP_XML_Server.



173
174
175
176
177
178
179
180
181
182
183
# File 'lib/msg-chumby-daemon/http-xml-server.rb', line 173

def initialize(host, port, reading_cache, boundaries)
  @server = Mongrel::HttpServer.new(host, port)
  @server.register("/time", TimeHandler.new)
  @server.register("/reset", ResetHandler.new)
  @server.register("/last_reading", LastReadingHandler.new(reading_cache))
  @server.register("/last_minute", LastMinuteHandler.new(reading_cache))
  @server.register("/last_hour", LastHourHandler.new(reading_cache))
  @server.register("/last_day", LastDayHandler.new(reading_cache))
  @server.register("/last_day", LastDayHandler.new(reading_cache))
  @server.register("/boundary_values", BoundaryHandler.new(boundaries))
end

Instance Method Details

#joinObject



187
188
189
# File 'lib/msg-chumby-daemon/http-xml-server.rb', line 187

def join
  @threads.join();
end

#startObject



184
185
186
# File 'lib/msg-chumby-daemon/http-xml-server.rb', line 184

def start
  @threads=@server.run
end

#stopObject



190
191
192
# File 'lib/msg-chumby-daemon/http-xml-server.rb', line 190

def stop
  @server.stop
end