Class: Edi::Google::Sender

Inherits:
BaseEdiService show all
Defined in:
app/services/edi/google/sender.rb

Overview

Transmits this partner's staged product_data ECLs to Google via the
Merchant API v1, upserting each ProductInput into the primary API data
source for the partner's feed label (one partner = one country = one source).

The data source must be cut over from FILE/FETCH to API input first
(see the migration task doc). Until then Feed::Google::MerchantApi::Client#primary_api_data_source!
raises Feed::Google::MerchantApi::Client::NotApiDataSourceError and the ECL is marked exception
without partial pushes — so this is safe to deploy before the cutover.

Defined Under Namespace

Classes: ProductInputHandler

Constant Summary collapse

MAX_INSERT_ATTEMPTS =

Per-product upsert attempts before a transient failure is recorded.

4
INSERT_CONCURRENCY =
5
PROGRESS_INTERVAL =
100

Constants included from RequestIdentifiable

RequestIdentifiable::REQUEST_ID_HEADERS

Constants included from AddressAbbreviator

AddressAbbreviator::MAX_LENGTH

Instance Attribute Summary

Attributes inherited from BaseEdiService

#orchestrator

Attributes inherited from BaseService

#options

Instance Method Summary collapse

Methods inherited from BaseEdiService

#amazon_feed_product_type, #duplicate_po_already_notified?, #initialize, #mark_duplicate_po_as_notified, #onboard_ordered_catalog_items, #report_order_creation_issues, #safe_process_edi_communication_log

Methods included from RequestIdentifiable

#partner_request_id

Methods included from AddressAbbreviator

#abbreviate_street, #collect_street_originals, #record_address_abbreviation_notes

Methods inherited from BaseService

#initialize, #log_debug, #log_error, #log_info, #log_warning, #logger, #process, #tagged_logger

Constructor Details

This class inherits a constructor from Edi::BaseEdiService

Instance Method Details

#call(edi_communication_logs = nil) ⇒ Object

Returns the processed logs.

Parameters:

  • edi_communication_logs (Enumerable<EdiCommunicationLog>, nil) (defaults to: nil)

    defaults to this partner's ready/retry product_data logs.

Returns:

  • the processed logs.



53
54
55
56
57
58
59
60
61
62
# File 'app/services/edi/google/sender.rb', line 53

def call(edi_communication_logs = nil)
  logs = Array(
    edi_communication_logs || EdiCommunicationLog.requiring_processing
                                                 .where(partner: orchestrator.partner, category: 'product_data')
                                                 .order(:created_at)
                                                 .to_a
  )
  logs.each { |ecl| deliver(ecl) }
  logs
end