26 lines
601 B
Ruby
26 lines
601 B
Ruby
class Api::V1::ChecksController < Api::V1::BaseController
|
|
|
|
# POST /checks or /checks.json
|
|
def create
|
|
@check = Check.new(check_params)
|
|
|
|
if @check.save
|
|
render json: { message: "created" }, status: :created
|
|
else
|
|
render json: @check.errors, status: :unprocessable_entity
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
# Use callbacks to share common setup or constraints between actions.
|
|
def set_check
|
|
@check = Check.find(params[:id])
|
|
end
|
|
|
|
# Only allow a list of trusted parameters through.
|
|
def check_params
|
|
params.require(:check).permit(:name, :description, :hostname)
|
|
end
|
|
|
|
end |