Sha256: efeb270d3d21d1edb21f60c6f1334118baf6fa4c35d5ea8411f4cb89bb776f67

Contents?: true

Size: 531 Bytes

Versions: 10

Compression:

Stored size: 531 Bytes

Contents

class HooksController < ApplicationController
  skip_before_action :verify_authenticity_token

  def trigger
    event = "hooks:#{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, 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/hooks_controller.rb
houston-core-0.9.1 app/controllers/hooks_controller.rb
houston-core-0.9.0 app/controllers/hooks_controller.rb
houston-core-0.9.0.rc1 app/controllers/hooks_controller.rb
houston-core-0.8.4 app/controllers/hooks_controller.rb
houston-core-0.8.3 app/controllers/hooks_controller.rb
houston-core-0.8.2 app/controllers/hooks_controller.rb
houston-core-0.8.1 app/controllers/hooks_controller.rb
houston-core-0.8.0 app/controllers/hooks_controller.rb
houston-core-0.8.0.pre2 app/controllers/hooks_controller.rb