diff options
| author | mo khan <mo@mokhan.ca> | 2015-02-09 20:36:18 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2015-02-09 20:36:18 -0700 |
| commit | 41c8858025eb14cab34635b058ccf761dd04eb90 (patch) | |
| tree | 092eebd37ce516b81b248507e82ead59dc63a07b /app | |
| parent | 34f53efff788b7558f63d973aad1f3475c27c125 (diff) | |
use api controller and log errors in fake agent.
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/api/agents/files_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/api/agents_controller.rb | 6 | ||||
| -rw-r--r-- | app/controllers/api/api_controller.rb | 5 | ||||
| -rw-r--r-- | app/controllers/application_controller.rb | 1 | ||||
| -rw-r--r-- | app/models/event_message.rb | 2 | ||||
| -rw-r--r-- | app/models/scanned.rb | 2 |
6 files changed, 10 insertions, 8 deletions
diff --git a/app/controllers/api/agents/files_controller.rb b/app/controllers/api/agents/files_controller.rb index b111048..c13eac9 100644 --- a/app/controllers/api/agents/files_controller.rb +++ b/app/controllers/api/agents/files_controller.rb @@ -1,6 +1,6 @@ module Api module Agents - class FilesController < ApplicationController + class FilesController < ApiController before_action do request.format = :json end diff --git a/app/controllers/api/agents_controller.rb b/app/controllers/api/agents_controller.rb index 16174b1..a7307f0 100644 --- a/app/controllers/api/agents_controller.rb +++ b/app/controllers/api/agents_controller.rb @@ -1,9 +1,5 @@ module Api - class AgentsController < ApplicationController - #before_action do - #request.format = :json - #end - + class AgentsController < ApiController def create @agent = Agent.create!(agent_params) end diff --git a/app/controllers/api/api_controller.rb b/app/controllers/api/api_controller.rb new file mode 100644 index 0000000..0316222 --- /dev/null +++ b/app/controllers/api/api_controller.rb @@ -0,0 +1,5 @@ +module Api + class ApiController < ApplicationController + protect_from_forgery with: :null_session + end +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 8ce68a5..209ec89 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,7 +2,6 @@ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. #protect_from_forgery with: :exception - protect_from_forgery with: :null_session protected diff --git a/app/models/event_message.rb b/app/models/event_message.rb index 0a0c9ae..75bd9ac 100644 --- a/app/models/event_message.rb +++ b/app/models/event_message.rb @@ -14,7 +14,7 @@ class EventMessage def to_hash { agent_id: agent_id, - event_type: event_type, + type: event_type, data: data } end diff --git a/app/models/scanned.rb b/app/models/scanned.rb new file mode 100644 index 0000000..cfe1b87 --- /dev/null +++ b/app/models/scanned.rb @@ -0,0 +1,2 @@ +class Scanned < Event +end |
