Sha256: 764672b7bf85659c4c5ef94a280cf728985a4dd6ccf3335ad78d5ff6d77b8882
Contents?: true
Size: 1.06 KB
Versions: 10
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module Shipit module Api class HooksController < BaseController require_permission :read, :hook, only: %i(index show) require_permission :write, :hook, only: %i(create update destroy) def index render_resources(hooks) end def show render(json: hook) end params do requires :delivery_url, String requires :events, Array[String] accepts :content_type, String end def create render_resource(hooks.create(params)) end params do accepts :delivery_url, String accepts :events, Array[String] accepts :content_type, String end def update hook.update(params) render_resource(hook) end def destroy render_resource(hook.destroy) end private def hook hooks.find(params[:id]) end def hooks Hook.where(stack_id: stack_id) end def stack_id stack.id if params[:stack_id].present? end end end end
Version data entries
10 entries across 10 versions & 1 rubygems