class MailgunCatcher::Event
Attributes
params[R]
Public Class Methods
new(params)
click to toggle source
# File lib/mailgun_catcher/event.rb, line 5 def initialize(params) @params = params.to_unsafe_h end
Public Instance Methods
error_message()
click to toggle source
# File lib/mailgun_catcher/event.rb, line 13 def error_message "[#{severity}] [#{reason}] #{recipient}: #{delivery_status}" end
event_data()
click to toggle source
# File lib/mailgun_catcher/event.rb, line 21 def event_data params.fetch('event-data', {}) end
grouping_error_message()
click to toggle source
# File lib/mailgun_catcher/event.rb, line 17 def grouping_error_message "[#{severity}] [#{reason}] #{recipient}" end
notify()
click to toggle source
# File lib/mailgun_catcher/event.rb, line 9 def notify notifiers.each { |notifier| notifier.notify(self) } end
Private Instance Methods
delivery_status()
click to toggle source
# File lib/mailgun_catcher/event.rb, line 31 def delivery_status return delivery_status_message if delivery_status_message.present? return delivery_status_description if delivery_status_description.present? 'missing delivery status message' end
delivery_status_description()
click to toggle source
# File lib/mailgun_catcher/event.rb, line 42 def delivery_status_description event_data.fetch('delivery-status', {}).fetch('description', '') end
delivery_status_message()
click to toggle source
# File lib/mailgun_catcher/event.rb, line 38 def delivery_status_message event_data.fetch('delivery-status', {}).fetch('message', '') end
event()
click to toggle source
# File lib/mailgun_catcher/event.rb, line 50 def event event_data.fetch('event', 'unkown event') end
notifiers()
click to toggle source
# File lib/mailgun_catcher/event.rb, line 27 def notifiers MailgunCatcher.config.notifiers.map { |notifier| notifier.constantize.new } end
reason()
click to toggle source
# File lib/mailgun_catcher/event.rb, line 58 def reason event_data.fetch('reason', '') end
recipient()
click to toggle source
# File lib/mailgun_catcher/event.rb, line 46 def recipient event_data.fetch('recipient', 'no recipient') end
severity()
click to toggle source
# File lib/mailgun_catcher/event.rb, line 54 def severity event_data.fetch('severity', '') end