Class: ListingIssues::AmazonAdapter

Inherits:
BaseAdapter show all
Defined in:
app/services/listing_issues/amazon_adapter.rb

Overview

Amazon listing issues, sourced from signals the SP-API pulls already persist:
active has_issues AmazonCatalogItemFlag rows (the SP-API listing issues
array, joined into text by Catalog::AmazonPricingAutomationService) and
CatalogItem#item_suppressed_status. Reads stored data only — never calls
Amazon — so it can't block on rate limits and stays consistent with whatever
the pricing / listings pulls last recorded.

Constant Summary collapse

PROVIDER =
'amazon'
SEGMENT_BOUNDARY =

The joined issues text is split back into per-issue segments on the
boundary before a "[xx_XX] " locale marker, so a ';' inside a message
doesn't fracture it.

/;\s+(?=\[[a-z]{2}_[A-Z]{2}\]\s)/
SEGMENT_FORMAT =

"[en_US] ERROR: 13013 - message" → locale / severity word / code / message.

/\A\[(?<locale>[a-z]{2}_[A-Z]{2})\]\s+(?<sev>ERROR|WARNING|INFO)?:?\s*(?<code>\d+)?\s*-?\s*(?<msg>.*)\z/m

Instance Method Summary collapse

Instance Method Details

#candidate_item_idsArray<Integer>

Returns:

  • (Array<Integer>)


24
25
26
# File 'app/services/listing_issues/amazon_adapter.rb', line 24

def candidate_item_ids
  (has_issues_item_ids + suppressed_item_ids + open_issue_item_ids).uniq
end

#issues_for(catalog_item) ⇒ Array<ListingIssues::Issue>

Parameters:

Returns:



30
31
32
# File 'app/services/listing_issues/amazon_adapter.rb', line 30

def issues_for(catalog_item)
  issues_from_flags(catalog_item) + issues_from_suppression(catalog_item)
end

#providerString

Returns:

  • (String)


21
# File 'app/services/listing_issues/amazon_adapter.rb', line 21

def provider = PROVIDER