Class: ProjectHooksController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ProjectHooksController
- Defined in:
- app/controllers/project_hooks_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
#after_sign_in_path_for, #api_authenticate!, #authenticated_via_token?, #current_project, #expire_revision!, #followed_projects, #no_cache, #oauth_authorize!, #read_revision, #require_login, #return_or_cache_revision!, #revision, #token_authenticate!, #unfurling?, #with_current_project
Methods included from UrlHelper
#feature_path, #link_to_project_feature
Instance Method Details
#trigger ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/project_hooks_controller.rb', line 5 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 |