Class: SpecialDelivery::EventFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/special_delivery/event_factory.rb

Constant Summary collapse

EVENT_TYPE_CLASSES =
{
  'opened'       => OpenEvent,
  'unsubscribed' => UnsubscribeEvent,
  'complained'   => ComplaintEvent,
  'bounced'      => BounceEvent,
  'clicked'      => ClickEvent,
  'dropped'      => DropEvent,
  'delivered'    => DeliveryEvent
}

Class Method Summary collapse

Class Method Details

.new_event(event_params) ⇒ Object



13
14
15
16
17
# File 'lib/special_delivery/event_factory.rb', line 13

def self.new_event(event_params)
  event_type = event_params.fetch(:event)

  EVENT_TYPE_CLASSES.fetch(event_type).new(event_params)
end