Class: ListingIssues::AmazonAdapter
- Inherits:
-
BaseAdapter
- Object
- BaseAdapter
- ListingIssues::AmazonAdapter
- 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
issuestext 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
- #candidate_item_ids ⇒ Array<Integer>
- #issues_for(catalog_item) ⇒ Array<ListingIssues::Issue>
- #provider ⇒ String
Instance Method Details
#candidate_item_ids ⇒ 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>
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 |
#provider ⇒ String
21 |
# File 'app/services/listing_issues/amazon_adapter.rb', line 21 def provider = PROVIDER |