Skip to content
Browse files

Proc syntax

  • Loading branch information...
1 parent 75bd3ee commit 5887aff528127693fce0e60aa7f6389bb7b815cf @aceofspades committed Mar 26, 2012
Showing with 3 additions and 3 deletions.
  1. +1 −1 README.md
  2. +2 −2 app/controllers/sendgrid_postback/events_controller.rb
View
2 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
View
4 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

0 comments on commit 5887aff

Please sign in to comment.
Something went wrong with that request. Please try again.