class Admin::HooksController

Public Instance Methods

create() click to toggle source
# File app/controllers/admin/hooks_controller.rb, line 7
def create
  @hook = SystemHook.new(params[:hook])

  if @hook.save
    redirect_to admin_hooks_path, notice: 'Hook was successfully created.'
  else
    @hooks = SystemHook.all
    render :index
  end
end
destroy() click to toggle source
# File app/controllers/admin/hooks_controller.rb, line 18
def destroy
  @hook = SystemHook.find(params[:id])
  @hook.destroy

  redirect_to admin_hooks_path
end
index() click to toggle source
# File app/controllers/admin/hooks_controller.rb, line 2
def index
  @hooks = SystemHook.all
  @hook = SystemHook.new
end
test() click to toggle source
# File app/controllers/admin/hooks_controller.rb, line 26
def test
  @hook = SystemHook.find(params[:hook_id])
  data = {
    event_name: "project_create",
    name: "Ruby",
    path: "ruby",
    project_id: 1,
    owner_name: "Someone",
    owner_email: "example@gitlabhq.com"
  }
  @hook.execute(data)

  redirect_to :back
end