Sha256: d6ab395ee9694c31e227abbc1ae402aaf7dc7912732b3b2409a0d6d980124564
Contents?: true
Size: 1.26 KB
Versions: 8
Compression:
Stored size: 1.26 KB
Contents
require "event_capture/events_controller" require "event_capture/event" module EventCapture # Augment/override behavior. class EventsController before_action :authenticate_participant! def event_params { kind: params[:kind], payload: payload_params.to_h.merge(remote_ip: request.remote_ip), emitted_at: params[:emittedAt], participant_id: current_participant.id } end private # Permit payload parameters defined in # app/assets/javascripts/think_feel_do_engine/event_capture/init.js def payload_params params.require(:payload).permit( :currentUrl, :headers, :ua, :buttonHtml, :parentHtml, headers: [] ) end end # Augment behavior. class Event belongs_to :participant def self.next_event_for(event) where(participant_id: event.participant_id) .where.not(kind: "videoPlay") .where("emitted_at > ?", event.emitted_at) .select(:participant_id, :kind, :emitted_at) .order(:emitted_at) .limit(1) .first end def current_url payload["currentUrl"] end def button_html payload["buttonHtml"] end def headers payload["headers"] end end end
Version data entries
8 entries across 8 versions & 1 rubygems