Sha256: 61279acec595c3d9ec59acc556e50bbd91e366fc6d64298644666c3ce4632610

Contents?: true

Size: 871 Bytes

Versions: 45

Compression:

Stored size: 871 Bytes

Contents

require "event_capture/events_controller"

# Augment/override behavior.
class EventCapture::EventsController
  before_action :authenticate_participant!

  def event_params
    {
      kind: params[:kind],
      payload: params[:payload].merge(remote_ip: request.remote_ip),
      emitted_at: params[:emittedAt],
      participant_id: current_participant.id
    }
  end
end

require "event_capture/event"

class EventCapture::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

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
think_feel_do_engine-3.18.0 config/initializers/event_capture.rb
think_feel_do_engine-3.17.2 config/initializers/event_capture.rb
think_feel_do_engine-3.17.1 config/initializers/event_capture.rb
think_feel_do_engine-3.17.0 config/initializers/event_capture.rb
think_feel_do_engine-3.16.3 config/initializers/event_capture.rb
think_feel_do_engine-3.16.2 config/initializers/event_capture.rb
think_feel_do_engine-3.16.1 config/initializers/event_capture.rb
think_feel_do_engine-3.15.7 config/initializers/event_capture.rb
think_feel_do_engine-3.16.0 config/initializers/event_capture.rb
think_feel_do_engine-3.15.6 config/initializers/event_capture.rb
think_feel_do_engine-3.15.5 config/initializers/event_capture.rb
think_feel_do_engine-3.15.4 config/initializers/event_capture.rb
think_feel_do_engine-3.15.3 config/initializers/event_capture.rb
think_feel_do_engine-3.15.2 config/initializers/event_capture.rb
think_feel_do_engine-3.15.1 config/initializers/event_capture.rb
think_feel_do_engine-3.15.0 config/initializers/event_capture.rb
think_feel_do_engine-3.14.9 config/initializers/event_capture.rb
think_feel_do_engine-3.14.8 config/initializers/event_capture.rb
think_feel_do_engine-3.14.7 config/initializers/event_capture.rb
think_feel_do_engine-3.14.6 config/initializers/event_capture.rb