Class: Edi::Openai::Orchestrator

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

Overview

Orchestrates the OpenAI Ads product-catalog feed as an EDI partner: it builds
a Google-Merchant-Center-shaped CSV of our sellable catalog and SFTP-pushes it
to OpenAI's commerce drop, logged through the standard EdiCommunicationLog
pipeline — the same generate → stage → transmit → log path every marketplace
partner uses.

Runs on the daily EdiProductDataFlowWorker cron. With no
execute_product_data_flow_every_x_hour gate, BaseOrchestrator#should_execute_flow?
is true on each run, so the feed ships once per day.

Replaces the bespoke OpenaiAdsFeedGeneratorWorker + Feed::OpenaiAds::SftpDelivery.

Constant Summary collapse

FEED_FILE_NAME =

OpenAI's feed connection reads this exact filename at the drop root.

'warmlyyours_product_feed.csv'

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, build_customer_id_to_partner_key_map, 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_inventory_flow, execute_listing_message_feed_flow, execute_order_flow, #execute_order_flow, execute_price_flow, #execute_price_flow, execute_product_data_flow, #ignore_back_orders, #initialize, #inventory_message_enabled?, orchestrator_for_customer_id, orchestrators, #pending_discontinue_lifetime, #price_message_enabled?, #product_data_enabled?, #return_notification_message_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



19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/services/edi/openai/orchestrator.rb', line 19

def self.partners
  {
    openai: {
      active:                    true,
      partner:                   :openai,
      transporter:               :sftp,
      product_data_remote_path:  '/',
      product_data_file_name:    FEED_FILE_NAME,
      confirm_outbound_processing: false
    }
  }
end

Instance Method Details

#execute_product_data_flowObject



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

def execute_product_data_flow
  return unless active

  product_data_processor.process
  product_data_sender.process
end

#product_data_processorObject



39
40
41
# File 'app/services/edi/openai/orchestrator.rb', line 39

def product_data_processor
  Edi::Openai::ProductDataProcessor.new(self, options)
end

#product_data_senderObject



43
44
45
# File 'app/services/edi/openai/orchestrator.rb', line 43

def product_data_sender
  Edi::Openai::Sender.new(self, options)
end