1
0
mirror of https://github.com/fspc/BikeShed-1.git synced 2025-04-04 05:33:22 -04:00
BikeShed-1/app/controllers/api/v1/logs_controller.rb
Jason Denney a00c1ed925 Finished Checkin/out feature for now
-Checkin/out api methods can be used while signed in
-Added checkout button in Netzke App, which also signs out in addition to checking out.
2013-05-19 16:41:43 -04:00

23 lines
687 B
Ruby

class Api::V1::LogsController < Api::V1::BaseController
def checkin
#must use @current_user since user may not have signed in
if @current_user.checked_in?
render :json => { "error" => "You are already checked in."}, :status => 404 and return
else
@current_user.checkin
render :nothing => true, :status => 204 and return
end
end
def checkout
#must use @current_user since user may not have signed in
if !@current_user.checked_in?
render :json => { "error" => "You were not even checked in."}, :status => 404 and return
else
@current_user.checkout
render :nothing => true, :status => 204 and return
end
end
end