lib/gamelocker_api/telemetry.rb in gamelocker_api-0.1.2 vs lib/gamelocker_api/telemetry.rb in gamelocker_api-0.1.3
- old
+ new
@@ -4,14 +4,16 @@
Event = Struct.new(:time, :type, :payload)
def initialize(telemetry_url)
@events = []
response = RestClient.get(telemetry_url)
parse(response.body)
+
+ return self
end
def parse(json)
Oj.load(json).each do |event|
- @events << Event.new(event['time'], event['type'], event['payload'])
+ @events << Event.new(Time.parse(event['time']), event['type'], event['payload'])
end
end
end
end