Sha256: b4a44b442b6e06fdb28a2ffdd8e561de3969c27047a755774efb33076a2b51cd
Contents?: true
Size: 766 Bytes
Versions: 5
Compression:
Stored size: 766 Bytes
Contents
# frozen_string_literal: true require 'emailbutler/webhooks/mappers/sendgrid' module Emailbutler module Webhooks class Receiver SENDGRID_USER_AGENT = 'SendGrid Event API' def self.call(...) new.call(...) end def call(user_agent:, payload:) select_mapper(user_agent) .call(payload: payload) .each { |event| message = Emailbutler.find_message_by(uuid: event.delete(:message_uuid)) next unless message Emailbutler.update_message(message, event) } end private def select_mapper(user_agent) case user_agent when SENDGRID_USER_AGENT then Emailbutler::Webhooks::Mappers::Sendgrid end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems