Class: EmailEvents::Service::HandleEvent
- Inherits:
-
EmailEvents::Service
- Object
- EmailEvents::Service
- EmailEvents::Service::HandleEvent
- Defined in:
- lib/email_events/services/handle_event.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(raw_response) ⇒ HandleEvent
constructor
A new instance of HandleEvent.
Methods inherited from EmailEvents::Service
Constructor Details
#initialize(raw_response) ⇒ HandleEvent
Returns a new instance of HandleEvent.
2 3 4 |
# File 'lib/email_events/services/handle_event.rb', line 2 def initialize(raw_response) @raw_response = raw_response end |
Instance Method Details
#call ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/email_events/services/handle_event.rb', line 6 def call sent_emails = EmailEvents::Service::RetrieveDataFromHeader.call(event_data: event_data) return if sent_emails.blank? # in occasional cases (when there's no UUID), there will be multiple sent_emails that match the event: we # apply the event handling to each one sent_emails.each do |email_data| begin mailer = email_data.mailer_class.constantize.send :new mailer.send :__handle_event, event_data, email_data end end # no data to output back to Rack nil end |