lib/mandrill/web_hook/processor.rb in mandrill-rails-1.0.2 vs lib/mandrill/web_hook/processor.rb in mandrill-rails-1.1.0

- old
+ new

@@ -19,15 +19,16 @@ # Command: processes all +mandrill_events+ def run! mandrill_events.each do |raw_payload| event_payload = wrap_payload(raw_payload) handler = "handle_#{event_payload.event_type}".to_sym - if callback_host && callback_host.respond_to?(handler) + if callback_host && callback_host.respond_to?(handler, true) callback_host.send(handler,event_payload) elsif self.respond_to?(handler) self.send(handler,event_payload) else - # TODO raise an error + raise Mandrill::Rails::Errors::MissingEventHandler, + "Expected handler method `#{handler}` for event type `#{event_payload.event_type}`" end end end # Returns a suitably ecapsulated +raw_event_payload+