Sha256: 4979db68e7176456a58622dd096afbf793f877ff7bf3548557679a978bed05e9

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

class Kuroko2::JobSuspendSchedulesController < Kuroko2::ApplicationController
  before_action :set_definition, only: %i(index create destroy)

  def index
    @suspend_schedules = @definition.job_suspend_schedules
    @suspend_schedule  = Kuroko2::JobSuspendSchedule.new
    render layout: false
  end

  def create
    suspend_schedule = @definition.job_suspend_schedules.create(job_suspend_schedule_params)

    if suspend_schedule.valid?
      render json: suspend_schedule, status: :created
    else
      render json: suspend_schedule.errors.full_messages, status: :bad_request
    end
  end

  def destroy
    suspend_schedule = Kuroko2::JobSuspendSchedule.find(params[:id])
    if suspend_schedule.destroy
      render json: suspend_schedule, status: :ok
    else
      render json: suspend_schedule, status: :bad_request
    end
  end

  private

  def job_suspend_schedule_params
    params.require(:job_suspend_schedule).permit(:cron)
  end

  def set_definition
    @definition = Kuroko2::JobDefinition.find(params[:job_definition_id])
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
kuroko2-0.8.0 app/controllers/kuroko2/job_suspend_schedules_controller.rb
kuroko2-0.7.0 app/controllers/kuroko2/job_suspend_schedules_controller.rb
kuroko2-0.6.0 app/controllers/kuroko2/job_suspend_schedules_controller.rb
kuroko2-0.5.2 app/controllers/kuroko2/job_suspend_schedules_controller.rb
kuroko2-0.5.1 app/controllers/kuroko2/job_suspend_schedules_controller.rb
kuroko2-0.5.0 app/controllers/kuroko2/job_suspend_schedules_controller.rb
kuroko2-0.4.6 app/controllers/kuroko2/job_suspend_schedules_controller.rb
kuroko2-0.4.5 app/controllers/kuroko2/job_suspend_schedules_controller.rb
kuroko2-0.4.4 app/controllers/kuroko2/job_suspend_schedules_controller.rb
kuroko2-0.4.3 app/controllers/kuroko2/job_suspend_schedules_controller.rb