Sha256: bf25b3997d59bc0fd1f5795f8767e11d791836533bcb076e4b82c860fa9fd0de

Contents?: true

Size: 721 Bytes

Versions: 3

Compression:

Stored size: 721 Bytes

Contents

module MotherBrain::API
  class V1
    class JobsEndpoint < MB::API::Endpoint
      helpers MB::API::Helpers

      rescue_from MB::JobNotFound do |ex|
        rack_response(ex.to_json, 404, "Content-type" => "application/json")
      end

      namespace 'jobs' do
        desc "list all jobs (completed and active)"
        get do
          job_manager.list
        end

        desc "list all active jobs"
        get 'active' do
          job_manager.active
        end

        desc "find and return the Job with the given ID"
        params do
          requires :job_id, type: String, desc: "job id"
        end
        get ':job_id' do
          find_job!(params[:job_id])
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
motherbrain-0.14.3 lib/mb/api/v1/jobs_endpoint.rb
motherbrain-0.14.2 lib/mb/api/v1/jobs_endpoint.rb
motherbrain-0.13.1 lib/mb/api/v1/jobs_endpoint.rb