Creating a simpler API endpoint for embedded parsing

This commit is contained in:
2016-09-12 21:13:06 -07:00
parent 6957ab7ac1
commit 04d9b0bf68
2 changed files with 8 additions and 2 deletions

View File

@@ -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