Skip to content

Commit

Permalink
#23 ensure sender_email works with inbound and other events
Browse files Browse the repository at this point in the history
  • Loading branch information
tardate committed Mar 30, 2015
1 parent ebc31df commit ad4cdf4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions lib/mandrill/web_hook/event_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ def headers
end

# Returns the email (String) of the sender.
# Applicable events: inbound
# Inbound messages: references 'from_email' message attribute.
# Send/Open/Click messages: references 'sender' message attribute.
def sender_email
msg['sender']
msg['from_email']||msg['sender']
end

# Returns the subject user email address.
Expand Down
6 changes: 3 additions & 3 deletions spec/mandrill/web_hook/event_decorator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
:in_reply_to => nil,
:references => [],
:headers => {},
:sender_email => nil,
:sender_email => '[email protected]',
:user_email => '[email protected]',
:recipients => [],
:recipient_emails => [],
Expand All @@ -113,7 +113,7 @@
:in_reply_to => nil,
:references => [],
:headers => {},
:sender_email => nil,
:sender_email => '[email protected]',
:user_email => '[email protected]',
:recipients => [],
:recipient_emails => [],
Expand All @@ -130,7 +130,7 @@
:in_reply_to => nil,
:references => [],
:headers => {},
:sender_email => nil,
:sender_email => '[email protected]',
:user_email => '[email protected]',
:recipients => [],
:recipient_emails => [],
Expand Down

0 comments on commit ad4cdf4

Please sign in to comment.