Class: WatchCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/city_watch/collector/receive.rb

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/city_watch/collector/receive.rb', line 3

def call(env)
	
	post_data = begin Yajl::Parser.new(:symbolize_keys => true).parse(env["rack.input"].read) || {} rescue {} end
	post_data[:received_at] = Time.now.to_s
	
	Collector.process(post_data)
	
	[200,{"Content-Type" => "text/plain"},["Got it!"]]
end