Class: Legion::Data::EventStore::ConsentState
- Inherits:
-
Projection
- Object
- Projection
- Legion::Data::EventStore::ConsentState
- Defined in:
- lib/legion/data/event_store/projection.rb
Instance Attribute Summary
Attributes inherited from Projection
Instance Method Summary collapse
Methods inherited from Projection
Constructor Details
This class inherits a constructor from Legion::Data::EventStore::Projection
Instance Method Details
#apply(event) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/legion/data/event_store/projection.rb', line 26 def apply(event) scope = event.dig(:data, :scope) return unless scope case event[:type] when 'consent.granted', 'consent.modified' @state[scope] = event.dig(:data, :tier) when 'consent.revoked' @state.delete(scope) end end |