Skip to content

Commit

Permalink
Proc syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Doug Puchalski committed Mar 26, 2012
1 parent 75bd3ee commit 5887aff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/sendgrid_postback/events_controller.rb
Expand Up @@ -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
Expand Down

0 comments on commit 5887aff

Please sign in to comment.