Class: Edi::Houzz::Orchestrator

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

Constant Summary

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, #confirm_outbound_processing?, #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_price_flow, #execute_price_flow, execute_product_data_flow, #execute_product_data_flow, #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



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/services/edi/houzz/orchestrator.rb', line 6

def self.partners
  {
    houzz: {
      active: true,
      partner: :houzz,
      customer_id: 2173297,
      transporter: :http_api,
      transporter_profile: :houzz_api,
      inventory_transporter: :http_api,
      inventory_transporter_profile: :houzz_api,
      inventory_message_remote_path: "#{Heatwave::Configuration.fetch(:houzz_api, :hostname)}/api?format=json&method=updateInventory",
      order_message_remote_path: "#{Heatwave::Configuration.fetch(:houzz_api, :hostname)}/api?format=json&method=getOrders&Status=Charged",
      # packing_slip_remote_path: "https://www.houzz.com/printBuyerOrder/orderId=",
      update_order_message_remote_path: "#{Heatwave::Configuration.fetch(:houzz_api, :hostname)}/api?format=json&method=updateOrder",
      support_contact: 'sellerapi@houzz.com'
    }
  }
end

Instance Method Details

#confirm_message_enabled?Boolean

Returns:

  • (Boolean)


89
90
91
# File 'app/services/edi/houzz/orchestrator.rb', line 89

def confirm_message_enabled?
  try(:update_order_message_remote_path).present?
end

#confirm_message_processorObject



93
94
95
96
97
# File 'app/services/edi/houzz/orchestrator.rb', line 93

def confirm_message_processor
  return Edi::NullProcessor.new(self, :confirm_message_processor, options) unless confirm_message_enabled?

  ConfirmMessageProcessor.new(self, options)
end

#confirm_message_senderObject



99
100
101
102
103
# File 'app/services/edi/houzz/orchestrator.rb', line 99

def confirm_message_sender
  return Edi::NullProcessor.new(self, :confirm_message_sender, options) unless confirm_message_enabled?

  ConfirmMessageSender.new(self, options)
end

#execute_inventory_flowObject



144
145
146
147
148
149
# File 'app/services/edi/houzz/orchestrator.rb', line 144

def execute_inventory_flow
  return unless active

  inventory_message_processor.process
  inventory_message_sender.process
end

#execute_order_flowObject



131
132
133
134
135
136
137
138
139
140
141
142
# File 'app/services/edi/houzz/orchestrator.rb', line 131

def execute_order_flow
  return unless active

  order_message_retriever.process
  sleep(1)
  order_message_processor.process
  sleep(1)
  # packing_slip_processor.process
  # sleep(1)
  confirm_message_sender.process
  sleep(1)
end

#feed_submission_result_enabled?Boolean

Returns:

  • (Boolean)


105
106
107
# File 'app/services/edi/houzz/orchestrator.rb', line 105

def feed_submission_result_enabled?
  try(:feed_submission_result_remote_path).present?
end

#feed_submission_result_processorObject



109
110
111
112
113
# File 'app/services/edi/houzz/orchestrator.rb', line 109

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

  InventoryMessageProcessor.new(self, options)
end

#ignore_back_ordersObject

for now back orders are ignored



156
157
158
# File 'app/services/edi/houzz/orchestrator.rb', line 156

def ignore_back_orders
  true
end

#inventory_message_enabled?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'app/services/edi/houzz/orchestrator.rb', line 25

def inventory_message_enabled?
  try(:inventory_message_remote_path).present?
end

#inventory_message_processorObject



29
30
31
32
33
# File 'app/services/edi/houzz/orchestrator.rb', line 29

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



35
36
37
38
39
# File 'app/services/edi/houzz/orchestrator.rb', line 35

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

  InventoryMessageSender.new(self, options)
end

#invoice_message_enabled?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'app/services/edi/houzz/orchestrator.rb', line 57

def invoice_message_enabled?
  try(:invoice_message_remote_path).present?
end

#invoice_message_processorObject



61
62
63
64
65
# File 'app/services/edi/houzz/orchestrator.rb', line 61

def invoice_message_processor
  return Edi::NullProcessor.new(self, :invoice_message_processor, options) unless invoice_message_enabled?

  InvoiceMessageProcessor.new(self, options)
end

#invoice_message_senderObject



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

def invoice_message_sender
  return Edi::NullProcessor.new(self, :invoice_message_sender, options) unless invoice_message_enabled?

  InvoiceMessageSender.new(self, options)
end

#order_message_enabled?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/services/edi/houzz/orchestrator.rb', line 41

def order_message_enabled?
  try(:order_message_remote_path).present?
end

#order_message_processorObject



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

def order_message_processor
  return Edi::NullProcessor.new(self, :order_message_processor, options) unless order_message_enabled?

  OrderMessageProcessor.new(self, options)
end

#order_message_retrieverObject



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

def order_message_retriever
  return Edi::NullProcessor.new(self, :order_message_processor, options) unless order_message_enabled?

  OrderMessageRetriever.new(self, options)
end

#packing_slip_enabled?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'app/services/edi/houzz/orchestrator.rb', line 73

def packing_slip_enabled?
  try(:packing_slip_remote_path).present?
end

#packing_slip_processorObject



83
84
85
86
87
# File 'app/services/edi/houzz/orchestrator.rb', line 83

def packing_slip_processor
  return Edi::NullProcessor.new(self, :packing_slip_processor, options) unless packing_slip_enabled?

  PackingSlipProcessor.new(self, options)
end

#packing_slip_retrieverObject



77
78
79
80
81
# File 'app/services/edi/houzz/orchestrator.rb', line 77

def packing_slip_retriever
  return Edi::NullProcessor.new(self, :packing_slip_retriever, options) unless packing_slip_enabled?

  PackingSlipRetriever.new(self, options)
end

#return_notification_message_enabled?Boolean

Returns:

  • (Boolean)


115
116
117
# File 'app/services/edi/houzz/orchestrator.rb', line 115

def return_notification_message_enabled?
  try(:return_notification_message_remote_path).present?
end

#return_notification_message_processorObject



119
120
121
122
123
# File 'app/services/edi/houzz/orchestrator.rb', line 119

def return_notification_message_processor
  return Edi::NullProcessor.new(self, :return_notification_message_processor, options) unless return_notification_message_enabled?

  ReturnNotificationMessageProcessor.new(self, options)
end

#return_notification_message_senderObject



125
126
127
128
129
# File 'app/services/edi/houzz/orchestrator.rb', line 125

def return_notification_message_sender
  return Edi::NullProcessor.new(self, :return_notification_message_sender, options) unless return_notification_message_enabled?

  ReturnNotificationMessageSender.new(self, options)
end

#ship_code_mapperObject



151
152
153
# File 'app/services/edi/houzz/orchestrator.rb', line 151

def ship_code_mapper
  ShipCodeMapper.new(self)
end