Sha256: a2a93a5c98dabaae279ad52089a1e060cdae03a98367bc57cc231384b0fbab55

Contents?: true

Size: 570 Bytes

Versions: 1

Compression:

Stored size: 570 Bytes

Contents

module BeanstalkApi

  class JobsController < BeanstalkApi::ApplicationController
    attr_reader :job

    before_filter :must_have_job

    def show
      render json: { job: format_job(job), statistics: connection.job_stats(params[:id]) }
    end

    def destroy
      connection.delete(params[:id])
      render json: { job: "Job '#{params[:id]}' Deleted" }
    end

    private
    
    def must_have_job
      @job = pool.peek_job(params[:id])
    rescue Beanstalk::NotFoundError
      render json: { error: "Job '#{params[:id]}' not found" }
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pvdgm_beanstalk_api-0.1.0 app/controllers/beanstalk_api/jobs_controller.rb