Sha256: 07f252fc09ba454fd497d74187338844f2dd2601a84cbca6e485b2c152587eff

Contents?: true

Size: 766 Bytes

Versions: 10

Compression:

Stored size: 766 Bytes

Contents

class ProjectHooksController < ApplicationController
  skip_before_action :verify_authenticity_token


  def trigger
    project = Project.find_by_slug(params[:project_id])
    unless project
      render plain: "A project with the slug '#{params[:project_id]}' could not be found", status: 404
      return
    end

    event = "hooks:project:#{params[:hook]}"
    unless Houston.observer.observed?(event)
      render plain: "A hook with the slug '#{params[:hook]}' is not defined", status: 404
      return
    end

    payload = params.except(:action, :controller).merge({
      sender: {
        ip: request.remote_ip,
        agent: request.user_agent
      }
    })

    Houston.observer.fire event, project: project, params: payload
    head 200
  end


end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
houston-core-0.9.2 app/controllers/project_hooks_controller.rb
houston-core-0.9.1 app/controllers/project_hooks_controller.rb
houston-core-0.9.0 app/controllers/project_hooks_controller.rb
houston-core-0.9.0.rc1 app/controllers/project_hooks_controller.rb
houston-core-0.8.4 app/controllers/project_hooks_controller.rb
houston-core-0.8.3 app/controllers/project_hooks_controller.rb
houston-core-0.8.2 app/controllers/project_hooks_controller.rb
houston-core-0.8.1 app/controllers/project_hooks_controller.rb
houston-core-0.8.0 app/controllers/project_hooks_controller.rb
houston-core-0.8.0.pre2 app/controllers/project_hooks_controller.rb