Class: Emailbutler::Webhooks::Receiver

Inherits:
Object
  • Object
show all
Defined in:
lib/emailbutler/webhooks/receiver.rb

Instance Method Summary collapse

Instance Method Details

#call(mapper:, payload:) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/emailbutler/webhooks/receiver.rb', line 6

def call(mapper:, payload:)
  return unless mapper

  mapper
    .call(payload: payload)
    .each { |event|
      message = Emailbutler.find_message_by(uuid: event.delete(:message_uuid))
      next unless message

      Emailbutler.update_message(message, event)
    }
end