lib/resque_pause/server.rb in resque-pause-0.0.2 vs lib/resque_pause/server.rb in resque-pause-0.0.3

- old
+ new

@@ -27,18 +27,20 @@ get '/pause' do erb File.read(ResquePause::Server.erb_path('pause.erb')) end post '/pause' do - ResquePauseHelper.pause(params['queue_name']) unless params['queue_name'].empty? - content_type :json - encode(:queue_name => params['queue_name'], :paused => true) - end + pause = params['pause'] == "true" - post '/unpause' do - ResquePauseHelper.unpause(params['queue_name']) unless params['queue_name'].empty? + unless params['queue_name'].empty? + if pause + ResquePauseHelper.pause(params['queue_name']) + else + ResquePauseHelper.unpause(params['queue_name']) + end + end content_type :json - encode(:queue_name => params['queue_name'], :paused => false) + encode(:queue_name => params['queue_name'], :paused => pause) end get /pause\/public\/([a-z]+\.[a-z]+)/ do send_file ResquePause::Server.public_path(params[:captures].first) end