Class: Edi::Menard::Orchestrator

Inherits:
BaseOrchestrator show all
Defined in:
app/services/edi/menard/orchestrator.rb

Constant Summary collapse

CATALOG_ID =
192
VENDOR_NUMBER =
'WARML001'

Constants inherited from BaseOrchestrator

BaseOrchestrator::DEFAULT_PENDING_DISCONTINUE_LIFETIME, BaseOrchestrator::ORCHESTRATORS, BaseOrchestrator::RECOMMENDED_EXECUTE_FLOW_EVERY_X_HOUR

Instance Attribute Summary

Attributes inherited from BaseOrchestrator

#config, #logger, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseOrchestrator

all_orchestrators_class, build, cached_build, cached_orchestrators, catalog_id_to_pending_discontinue_lifetime, catalog_ids_edi_enabled, #customer, #customer_catalog, customer_id_to_partner_key_map, #customer_ids, customer_ids_edi_enabled, customer_ids_with_invoice_message_enabled, #customers, execute_discontinue_flow, execute_flow, execute_inventory_flow, execute_listing_message_feed_flow, execute_order_flow, #execute_order_flow, execute_price_flow, #execute_price_flow, execute_product_data_flow, #execute_product_data_flow, #ignore_back_orders, #initialize, orchestrator_for_customer_id, orchestrators, #pending_discontinue_lifetime, #price_message_enabled?, #product_data_enabled?, #should_execute_flow?, #should_execute_order_flow?, #should_execute_product_data_flow?, #test_mode?

Constructor Details

This class inherits a constructor from Edi::BaseOrchestrator

Class Method Details

.partnersObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/services/edi/menard/orchestrator.rb', line 8

def self.partners
  {
    menard: {
      active: true,
      partner: :menard,
      customer_id: 21_746_416,
      catalog_id: CATALOG_ID,
      vendor_number: VENDOR_NUMBER,
      inventory_message_enabled: true,
      execute_inventory_flow_every_x_hour: 8,
      pending_discontinue_lifetime_duration: 7.days,
      transporter: :playwright_portal,
      portal_base_url: 'https://partners.menard-inc.com/partners',
      support_contact: 'cdepies@menard-inc.com',
      product_specialist_email: 'cdepies@menard-inc.com',
      merchant_email: 'mfountai@menard-inc.com',
      associate_merchant_email: 'ngrabau@menard-inc.com'
    }
  }
end

Instance Method Details

#confirm_outbound_processing?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'app/services/edi/menard/orchestrator.rb', line 62

def confirm_outbound_processing?
  false
end

#discontinue_flow_processorObject



58
59
60
# File 'app/services/edi/menard/orchestrator.rb', line 58

def discontinue_flow_processor
  DiscontinueFlowProcessor.new(self, options)
end

#discontinue_notification_recipientsObject



81
82
83
# File 'app/services/edi/menard/orchestrator.rb', line 81

def discontinue_notification_recipients
  menard_contacts.values.compact + ['ediadmin@warmlyyours.com']
end

#execute_discontinue_flowObject



52
53
54
55
56
# File 'app/services/edi/menard/orchestrator.rb', line 52

def execute_discontinue_flow
  return false unless active

  discontinue_flow_processor.process
end

#execute_inventory_flowObject



45
46
47
48
49
50
# File 'app/services/edi/menard/orchestrator.rb', line 45

def execute_inventory_flow
  return false unless active

  inventory_message_processor.process
  inventory_message_sender.process
end

#inventory_message_enabled?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'app/services/edi/menard/orchestrator.rb', line 29

def inventory_message_enabled?
  inventory_message_enabled
end

#inventory_message_processorObject



33
34
35
36
37
# File 'app/services/edi/menard/orchestrator.rb', line 33

def inventory_message_processor
  return Edi::NullProcessor.new(self, :inventory_message_processor, options) unless inventory_message_enabled?

  InventoryMessageProcessor.new(self, options)
end

#inventory_message_senderObject



39
40
41
42
43
# File 'app/services/edi/menard/orchestrator.rb', line 39

def inventory_message_sender
  return Edi::NullProcessor.new(self, :inventory_message_sender, options) unless inventory_message_enabled?

  InventoryMessageSender.new(self, options)
end

#menard_contactsObject



73
74
75
76
77
78
79
# File 'app/services/edi/menard/orchestrator.rb', line 73

def menard_contacts
  {
    product_specialist: product_specialist_email,
    merchant: merchant_email,
    associate_merchant: associate_merchant_email
  }
end

#portal_credentialsObject



66
67
68
69
70
71
# File 'app/services/edi/menard/orchestrator.rb', line 66

def portal_credentials
  {
    username: Heatwave::Configuration.fetch(:menard, :portal_username),
    password: Heatwave::Configuration.fetch(:menard, :portal_password)
  }
end