Class: Jobit::JobsController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/jobit/jobs_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/jobit/jobs_controller.rb', line 4

def index
  job = Jobit::Job.find_by_name(params[:id])

  if job.nil?
    json_response = {:status => 'not_found'}
  else
    json_response = job.session
    if job.status == 'complete'
      job.destroy if job.status == "complete"
    end
  end

  render :json => json_response
end