module JSONiCal class VEVENTDispatcher EVENT_MAP = { 'create' => JSONiCal::CreateOrUpdateVEVENTService, 'update' => JSONiCal::CreateOrUpdateVEVENTService, 'delete' => JSONiCal::DeleteVEVENTService }.freeze def initialize(event_map: EVENT_MAP, key:, message:) @map = event_map @key = key @message = message end def call @map[@key].new(@message).call end end end