Sha256: 1f4c3386e5e543d0d6a1ac89dc2df6f41679d13a15395823447a3d71ec54cff5

Contents?: true

Size: 787 Bytes

Versions: 5

Compression:

Stored size: 787 Bytes

Contents

module Asyncapi
  module Server
    module V1
      class JobsController < ApplicationController # TODO: Asyncapi::Server.parent_controller

        protect_from_forgery with: :null_session
        respond_to :json

        def index
          jobs = paginate Job.all
          serializer = ActiveModel::ArraySerializer.new(jobs)
          render json: serializer
        end

        def show
          job = Job.find(params[:id])
          job = JobSerializer.new(job)
          render json: job
        end

        def destroy
          job = Job.find_by(id: params[:id], secret: params[:secret])
          if job
            job.destroy
            respond_with job
          else
            render nothing: true, status: 404
          end
        end

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
asyncapi-server-1.1.3 app/controllers/asyncapi/server/v1/jobs_controller.rb
asyncapi-server-1.1.2 app/controllers/asyncapi/server/v1/jobs_controller.rb
asyncapi-server-1.1.1 app/controllers/asyncapi/server/v1/jobs_controller.rb
asyncapi-server-1.1.0 app/controllers/asyncapi/server/v1/jobs_controller.rb
asyncapi-server-1.0.0 app/controllers/asyncapi/server/v1/jobs_controller.rb