Adding json formats to space api access

This commit is contained in:
Will Bradley 2014-01-21 19:38:11 -07:00
parent 8060f76cca
commit a2a9d082d8

View File

@ -38,8 +38,19 @@ class SpaceApiController < ApplicationController
else else
unless can? :access_doors_remotely, :door_access unless can? :access_doors_remotely, :door_access
@output = "Sorry, your account isn't able to control doors remotely." @output = "Sorry, your account isn't able to control doors remotely."
else
@output = "Ready to control doors. Send POST params to this URL as per the HTML form."
end end
end end
# Render the form again (or result)
respond_to do |format|
format.html
format.json {
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
render :json => @output
}
end
end end
def access_post def access_post
@ -78,8 +89,17 @@ class SpaceApiController < ApplicationController
end end
end end
# Render the form again # Render the form again (or result)
render :access respond_to do |format|
format.html {
render :access
}
format.json {
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
render :json => @output
}
end
end end
def check_auth(email,password) def check_auth(email,password)