summaryrefslogtreecommitdiff
path: root/app/controllers/api/agents/files_controller.rb
blob: fd7410c0e382ac6192b21b9760a4b47759d43ca7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module Api
  module Agents
    class FilesController < ApplicationController
      before_action do
        request.format = :json
      end

      def show
        @agent = Agent.find(params[:agent_id])
        @fingerprint = params[:id]
        @file = Disposition.find_by(fingerprint: params[:id])
        message = {
          agent_id: params[:id],
          type: :lookup,
          data: params[:data]
        }
        Publisher.publish("events.scanned.#{@agent.id}", message)
      end
    end
  end
end