Sha256: 73ca5a6883cab6e9a8b7321f86a1ef2b063db6592d71c95793c9983c98a1458e
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
module Webhookr class EventsController < ActionController::Base http_basic_authenticate_with( :name => Webhookr.config.basic_auth.username, :password => Webhookr.config.basic_auth.password ) if Webhookr.config.basic_auth.username && Webhookr.config.basic_auth.password before_filter :create_service def show render :nothing => true end def create @service.process! render :nothing => true end private def create_service begin # Rails 4.0.0 fix: https://github.com/rails/rails/pull/11353 request.body.rewind @service = Webhookr::Service.new( params[:service_id], :payload => request.body.read, :security_token => params[:security_token] ) rescue NameError => e raise ActionController::RoutingError.new("No service '#{params[:service_id]}' is available.") rescue Webhookr::InvalidSecurityTokenError => e raise ActionController::InvalidAuthenticityToken.new("Invalid or missing security token for service '#{params[:service_id]}'.") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
webhookr-0.2.0 | app/controllers/webhookr/events_controller.rb |
webhookr-0.1.0 | app/controllers/webhookr/events_controller.rb |