class MingleEvents::Processors::CardTypeFilter
Filters events by card types. As events do not contain the type of the card, this filter requires a lookup against Mingle to determine the type of the card that sourced the event. In the case of the card’s being deleted in the interim between the actual event and this filtering, the event will be filtered as there is no means to determine its type. Therefore, it’s recommended to also subscribe a ‘CardDeleted’ processor to the same project.
Public Class Methods
new(card_types, card_data)
click to toggle source
# File lib/mingle_events/processors/card_type_filter.rb 13 def initialize(card_types, card_data) 14 @card_types = card_types 15 @card_data = card_data 16 end
Public Instance Methods
match?(event)
click to toggle source
# File lib/mingle_events/processors/card_type_filter.rb 18 def match?(event) 19 event.card? && 20 @card_data.for_card_event(event) && 21 @card_types.include?(@card_data.for_card_event(event)[:card_type_name]) 22 end