summaryrefslogtreecommitdiff
path: root/app/controllers/api/agents/events_controller.rb
blob: 56b566fb2ed36a3a40783c1589b0e9ba4414d6c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module Api
  module Agents
    class EventsController < ApiController
      def create
        @agent = Agent.find(params[:agent_id])
        publish(EventMessage.new(
          agent_id: @agent.id,
          event_type: event_params[:type],
          data: event_params[:data]
        ))

        render nothing: true
      end

      private

      def event_params
        params[:event]
      end
    end
  end
end