Class: MenardDiscontinueNotifyWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Job
Defined in:
app/workers/menard_discontinue_notify_worker.rb

Overview

Manual trigger for Menard discontinue notifications. Normally handled
automatically by the hourly EdiDiscontinueFlowWorker which calls
Edi::Menard::DiscontinueFlowProcessor for all pending_discontinue items.

Use this worker to manually send a notification for a specific catalog item,
e.g. from the console: MenardDiscontinueNotifyWorker.perform_async(ci_id)

Instance Method Summary collapse

Instance Method Details

#perform(catalog_item_id) ⇒ Object

Parameters:

  • catalog_item_id (Integer)


15
16
17
18
19
20
21
22
# File 'app/workers/menard_discontinue_notify_worker.rb', line 15

def perform(catalog_item_id)
  catalog_item = CatalogItem.find(catalog_item_id)
  return unless catalog_item.pending_discontinue?
  return if catalog_item.pending_discontinue_date.present?

  orchestrator = Edi::Menard::Orchestrator.new(:menard)
  orchestrator.discontinue_flow_processor.process_catalog_item(catalog_item)
end