Class: Edi::ResellerInventory::Sender

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

Overview

Emails a reseller's staged inventory ECL via CommunicationBuilder (the
INVENTORY_FEED email template, the CSV attached), then records the result
on the ECL. Mirrors the legacy Feed::TransmitEmail send.

Constant Summary collapse

UPLOAD_CATEGORY =
'EdiInventoryFeed'

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

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

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, #tagged_logger

Constructor Details

This class inherits a constructor from Edi::BaseEdiService

Instance Method Details

#process(edi_communication_logs = nil) ⇒ Object

Parameters:

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

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



12
13
14
15
16
17
18
19
20
21
# File 'app/services/edi/reseller_inventory/sender.rb', line 12

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