Sha256: 45c2915dfd08045246a3da803844d495613600ac423f6f2dcfc03561542d78ef
Contents?: true
Size: 750 Bytes
Versions: 3
Compression:
Stored size: 750 Bytes
Contents
module StripeEvent class WebhookController < ActionController::Base if respond_to?(:before_action) before_action :request_authentication else before_filter :request_authentication end def event StripeEvent.instrument(params) head :ok rescue StripeEvent::UnauthorizedError => e log_error(e) head :unauthorized end private def log_error(e) logger.error e.message e.backtrace.each { |line| logger.error " #{line}" } end def request_authentication if StripeEvent.authentication_secret authenticate_or_request_with_http_basic do |username, password| password == StripeEvent.authentication_secret end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems