diff --git a/app/controllers/space_api_controller.rb b/app/controllers/space_api_controller.rb index 6a76d91..39dcadf 100755 --- a/app/controllers/space_api_controller.rb +++ b/app/controllers/space_api_controller.rb @@ -1,8 +1,8 @@ class SpaceApiController < ApplicationController # Individually remove authorizing stuff since there is no SpaceApi model - authorize_resource :except => [:index, :access, :access_post, :alert_if_not_status] + authorize_resource :except => [:index, :simple, :access, :access_post, :alert_if_not_status] # User auth here happens via params, instead of form. - before_filter :authenticate_user!, :except => [:index, :access, :access_post, :alert_if_not_status] + before_filter :authenticate_user!, :except => [:index, :simple, :access, :access_post, :alert_if_not_status] def index @json = JSON.parse(Setting.space_api_json_template) @@ -29,6 +29,11 @@ class SpaceApiController < ApplicationController end end + def simple + door_status = DoorLog.show_status # Expect {:unlocked => boolean, :door_1_locked => boolean, :door_2_locked => boolean} + render :json => door_status + end + def access @status = DoorLog.show_status diff --git a/config/routes.rb b/config/routes.rb index 8b99f7b..8b636f4 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -55,6 +55,7 @@ Dooraccess::Application.routes.draw do match 'cards/:id/upload' => 'cards#upload', :as => :upload match 'space_api' => 'space_api#index', :as => :space_api + match 'space_api/simple(.format)' => 'space_api#simple', :as => :space_api_simple match 'space_api/alert_if_not/:status' => 'space_api#alert_if_not_status', :via => :get, :as => :space_api_alert_if_not_status match 'space_api/access' => 'space_api#access', :via => :get, :as => :space_api_access match 'space_api/access' => 'space_api#access_post', :via => :post