Open-Source-Access-Control-.../app/controllers/door_logs_controller.rb

39 lines
909 B
Ruby
Raw Normal View History

2012-08-25 06:28:00 +00:00
class DoorLogsController < ApplicationController
2012-09-16 10:24:54 +00:00
authorize_resource :except => :auto_download
before_filter :authenticate_user!, :except => :auto_download
2012-09-02 11:19:13 +00:00
2012-08-25 06:28:00 +00:00
# GET /door_logs
# GET /door_logs.json
def index
@door_logs = DoorLog.find(:all, :order => "created_at DESC", :limit => 500)
2012-08-25 06:28:00 +00:00
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @door_logs }
end
end
2012-09-16 10:24:54 +00:00
# GET /door_logs/download
2012-08-25 06:28:00 +00:00
def download
@results = DoorLog.download_from_door
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @results }
end
end
2012-09-16 10:24:54 +00:00
# GET /door_logs/auto_download
def auto_download
@results = DoorLog.download_from_door
@status = DoorLog.download_status # for space_api
2012-09-16 10:24:54 +00:00
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @results }
end
end
2012-08-25 06:28:00 +00:00
end