class MingleEvents::Processors::CustomPropertyFilter

Filters events by a single custom property value. As events will not necessarily contain this data, 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(property_name, property_value, card_data) click to toggle source
   # File lib/mingle_events/processors/custom_property_filter.rb
14 def initialize(property_name, property_value, card_data)
15   @property_name = property_name
16   @property_value = property_value
17   @card_data = card_data
18 end

Public Instance Methods

match?(event) click to toggle source
   # File lib/mingle_events/processors/custom_property_filter.rb
20 def match?(event)
21   event.card? && 
22     @card_data.for_card_event(event) &&
23     @property_value == @card_data.for_card_event(event)[:custom_properties][@property_name]
24 end