Class: Edi::ResellerInventory::InventoryProcessor
- Inherits:
-
BaseEdiService
- Object
- BaseService
- BaseEdiService
- Edi::ResellerInventory::InventoryProcessor
- Defined in:
- app/services/edi/reseller_inventory/inventory_processor.rb
Overview
Builds a reseller's inventory CSV — their catalog's EDI-feed-eligible items,
rendered through the reseller's Templates template — and stages it as an
outbound inventory_advice EdiCommunicationLog for Sender.
Constant Summary
Constants included from AddressAbbreviator
AddressAbbreviator::MAX_LENGTH
Instance Attribute Summary
Attributes inherited from BaseEdiService
Attributes inherited from BaseService
Instance Method Summary collapse
-
#process ⇒ EdiCommunicationLog
The staged outbound feed (state
ready).
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 ⇒ EdiCommunicationLog
Returns the staged outbound feed (state ready).
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/services/edi/reseller_inventory/inventory_processor.rb', line 9 def process items = catalog_items.to_a logger.info "Building inventory feed for #{orchestrator.partner} (#{items.size} items)" csv = Renderer.new(items).render(Templates.fetch(orchestrator.inventory_template)) # create_outbound_file_from_data wraps its own DB write in a transaction, so # nothing holds one open across item loading + ERB rendering. EdiCommunicationLog.create_outbound_file_from_data( data: csv, file_extension: 'csv', partner: orchestrator.partner, category: 'inventory_advice', data_type: 'csv', file_info: { item_count: items.size } ) end |