Class: Edi::Google::Orchestrator

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

Overview

Orchestrates the Google Merchant feed as an EDI partner, ONE partner per
country/feed label (google_merchant_us, google_merchant_ca) — mirroring
the per-region convention of the other marketplaces (amazon_seller_central_us,
wayfair_us/wayfair_ca). Each partner generates its catalog as Merchant
API ProductInputs and pushes them to that country's primary API data
source, logged through the standard EdiCommunicationLog pipeline.

Replaces the fetch-feed model (XML served at /api/v1/:locale/google/products,
pulled by Google) with a direct API push, which — unlike a fetch feed — can
DELETE products immediately rather than waiting ~30 days for expiry.

Per-country partners keep each daily push small (one country ≈ ~780 products)
so a run completes well within the worker window, and let US/CA roll out,
retry, and report independently.

Runs on the daily EdiProductDataFlowWorker cron (once per partner). No
execute_product_data_flow_every_x_hour gate, so each ships once per run.

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, 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?, #supports_flow?, #test_mode?

Constructor Details

This class inherits a constructor from Edi::BaseOrchestrator

Class Method Details

.partnersObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/services/edi/google/orchestrator.rb', line 23

def self.partners
  {
    google_merchant_us: {
      active: true,
      partner: :google_merchant_us,
      feed_label: 'US',
      catalog_id: Catalog::US_CATALOG_ID,
      product_data_enabled: true,
      confirm_outbound_processing: false
    },
    google_merchant_ca: {
      active: true,
      partner: :google_merchant_ca,
      feed_label: 'CA',
      catalog_id: Catalog::CA_CATALOG_ID,
      product_data_enabled: true,
      confirm_outbound_processing: false
    }
  }
end

Instance Method Details

#execute_product_data_flowObject



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

def execute_product_data_flow
  return unless active

  product_data_processor.call
  product_data_sender.call
  promotion_data_processor.process
  promotion_data_sender.process
end

#product_data_processorObject



53
54
55
# File 'app/services/edi/google/orchestrator.rb', line 53

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

#product_data_senderObject



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

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

#promotion_data_processorObject



61
62
63
# File 'app/services/edi/google/orchestrator.rb', line 61

def promotion_data_processor
  Edi::Google::PromotionDataProcessor.new(self, options)
end

#promotion_data_senderObject



65
66
67
# File 'app/services/edi/google/orchestrator.rb', line 65

def promotion_data_sender
  Edi::Google::PromotionSender.new(self, options)
end