Sha256: bc3b774a0c99f714dbb24e74deccdf057b7fcd1b510baa32decef451857a5a6f
Contents?: true
Size: 736 Bytes
Versions: 3
Compression:
Stored size: 736 Bytes
Contents
module Ahoy class EventsController < Ahoy::BaseController def create events = if params[:name] # legacy API [params] else begin ActiveSupport::JSON.decode(request.body.read) rescue ActiveSupport::JSON.parse_error # do nothing [] end end events.each do |event| time = Time.zone.parse(event["time"]) rescue nil # timestamp is deprecated time ||= Time.zone.at(event["time"].to_f) rescue nil options = { id: event["id"], time: time } ahoy.track event["name"], event["properties"], options end render json: {} end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ahoy_matey-1.1.1 | app/controllers/ahoy/events_controller.rb |
ahoy_matey-1.1.0 | app/controllers/ahoy/events_controller.rb |
ahoy_matey-1.0.2 | app/controllers/ahoy/events_controller.rb |