Class: EventDispatchers::NewLoadTenderEventDispatcher
- Inherits:
-
BaseEventDispatcher
- Object
- BaseEventDispatcher
- EventDispatchers::NewLoadTenderEventDispatcher
- Defined in:
- app/notifications/event_dispatchers/new_load_tender_event_dispatcher.rb
Instance Attribute Summary
Attributes inherited from BaseEventDispatcher
Instance Method Summary collapse
Methods inherited from BaseEventDispatcher
Constructor Details
This class inherits a constructor from EventDispatchers::BaseEventDispatcher
Instance Method Details
#dispatch ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/notifications/event_dispatchers/new_load_tender_event_dispatcher.rb', line 3 def dispatch Edi204.where(company_id: company_id) .where('created_at >= ?', 1.hour.ago) .find_each do |edi204| ReferenceEvent.find_or_create_by!( slug: ReferenceEvent::Slugs::NEW_LOAD_TENDER, level: ReferenceEvent::Levels::INFO, company_id: company_id, reference: edi204, end_at: nil ).tap do |reference_event| reference_event.update!( last_verified_at: Time.current ) end end end |