From 5887aff528127693fce0e60aa7f6389bb7b815cf Mon Sep 17 00:00:00 2001 From: Doug Puchalski Date: Mon, 26 Mar 2012 13:38:40 -0700 Subject: [PATCH] Proc syntax --- README.md | 2 +- app/controllers/sendgrid_postback/events_controller.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d0b8088..d4bfea1 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Configure the library, i.e. in your app's `config/initializers/sendgrid_postback # proc that accepts an exception for reporting config.report_exception = proc { |exc| ... } # Optional - # proc that returns an instance for the given uuid. + # Proc that returns an instance for the given uuid. # The class should mix in SendgridPostback::EventReceiver config.find_receiver_by_uuid = proc { |uuid| ...} # Required end diff --git a/app/controllers/sendgrid_postback/events_controller.rb b/app/controllers/sendgrid_postback/events_controller.rb index 92aeae1..0cb5d6f 100644 --- a/app/controllers/sendgrid_postback/events_controller.rb +++ b/app/controllers/sendgrid_postback/events_controller.rb @@ -9,9 +9,9 @@ class SendgridPostback::EventsController < ActionController::Metal # curl -i -H "Content-Type: application/json" -X POST -d '{"email": "test@gmail.com", "event": "processed"}{"email": "test2@gmail.com", "event": "processed2"}' http://localhost:3000/sendgrid_postback/events def create parse_send_grid_events do |data| - receiver = SendgridPostback.config.find_receiver_by_uuid(data[:uuid]) + receiver = SendgridPostback.config.find_receiver_by_uuid.call(data[:uuid]) if receiver.blank? - SendgridPostback.config.report_exception "SendgridPostback postback: Notification UUID(#{data[:uuid]}) not found." + SendgridPostback.config.report_exception.call("SendgridPostback postback: Notification UUID(#{data[:uuid]}) not found.") else receiver.post_sendgrid_event(data) end