Sha256: ec8c6f8d5633ac7a2d8319cc5aca7fe2aeb533d25b359db29dfc237a1949471a

Contents?: true

Size: 764 Bytes

Versions: 3

Compression:

Stored size: 764 Bytes

Contents

class ProjectHooksController < ApplicationController
  skip_before_filter :verify_authenticity_token


  def trigger
    project = Project.find_by_slug(params[:project_id])
    unless project
      render text: "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 text: "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

3 entries across 3 versions & 1 rubygems

Version Path
houston-core-0.8.0.pre app/controllers/project_hooks_controller.rb
houston-core-0.7.0 app/controllers/project_hooks_controller.rb
houston-core-0.7.0.beta4 app/controllers/project_hooks_controller.rb