Class: ListingIssues::WayfairAdapter
- Inherits:
-
BaseAdapter
- Object
- BaseAdapter
- ListingIssues::WayfairAdapter
- Defined in:
- app/services/listing_issues/wayfair_adapter.rb
Overview
Wayfair listing issues, derived from the Wayfair Supplier Catalog data our
daily catalog pull persists (Edi::Wayfair::CatalogItemInformationProcessor →
Models::CatalogItemWayfairHelper jsonb accessors) and the taxonomy schema
(WayfairSchema) the listing generator maps against. Reads stored data only —
never calls Wayfair — so it can't block on the API and stays consistent with
whatever the last catalog pull recorded. Mirrors AmazonAdapter /
WalmartAdapter; registered in Sync.adapters.
Scope is the launched Wayfair markets — Wayfair catalogs with at least one
synced item (US + Canada today). Germany (catalog 267) has zero synced items
and is excluded until it launches, so its not-yet-listed items don't flood the
dashboard; it auto-joins once the daily pull starts matching its products.
v1 covers the signals computable from stored data:
- not_synced — active Wayfair item with no listing data matched in the latest
catalog pull (no product id / status / class). Warning: usually a
mid-onboarding item or a stale sync, and auto-resolves once the pull
matches it. - not_live — Wayfair reports a product status other than LIVE. Error.
- class_desired_mismatch — our desired classification
(CatalogItem#wayfair_desired_taxonomy_category_id) differs from the class
Wayfair currently reports — a pending re-class. Warning; auto-resolves once
Wayfair completes the class correction and the next v2 pull confirms it. - duplicate_parent_products — one supplier part number is live beneath
multiple WRM parent products in the same market. Error; sourced only
from a successfully completed v1 catalog scan. - missing_required_spec — required taxonomy attributes Wayfair holds no
value for on the live listing, aggregated into one row per item. Error;
dormant until a WayfairSchema is cached for the item's category AND the
v2 pull has recorded the listing's attribute coverage. - insights — Wayfair's OWN diagnostics from Catalog Read v2
(supplierCatalogItems.insights, persisted by
Edi::Wayfair::CatalogReadV2Retriever), one issue per insight:
problems→error, warnings→warning, opportunities→warning.codeis the
stableinsightTypeId. This is the authoritative source for Wayfair's
missing-required/recommended-attribute and quality anomalies.
Live image count / "only one image" is still NOT exposed by the read API (the
products images array comes back empty without media read), so that check
remains phase 2 — fed by a media-read query or the live PDP probe.
Constant Summary collapse
- PROVIDER =
Provider key stamped on issues produced by this adapter.
'wayfair'- WAYFAIR_COUNTRY_BY_CATALOG =
Maps each Wayfair catalog to its WayfairSchema country, so spec checks load
the market-correct schema (a US schema must not be reused for a CA item). { CatalogConstants::WAYFAIR_USA => 'UNITED_STATES', CatalogConstants::WAYFAIR_CANADA => 'CANADA', CatalogConstants::WAYFAIR_GERMANY => 'GERMANY' }.freeze
Instance Method Summary collapse
-
#candidate_item_ids ⇒ Array<Integer>
Active items in launched Wayfair markets, plus any item already carrying an open Wayfair issue (so cleared issues auto-resolve on the next run).
-
#eager_load ⇒ Array
Associations the bulk sweep eager-loads before #issues_for.
- #issues_for(catalog_item) ⇒ Array<ListingIssues::Issue>
- #provider ⇒ String
Instance Method Details
#candidate_item_ids ⇒ Array<Integer>
Active items in launched Wayfair markets, plus any item already carrying an
open Wayfair issue (so cleared issues auto-resolve on the next run).
64 65 66 |
# File 'app/services/listing_issues/wayfair_adapter.rb', line 64 def candidate_item_ids (market_item_ids + open_issue_item_ids).uniq end |
#eager_load ⇒ Array
Returns associations the bulk sweep eager-loads before #issues_for.
89 90 91 |
# File 'app/services/listing_issues/wayfair_adapter.rb', line 89 def eager_load [{ store_item: :item }] end |
#issues_for(catalog_item) ⇒ Array<ListingIssues::Issue>
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'app/services/listing_issues/wayfair_adapter.rb', line 70 def issues_for(catalog_item) # Only active listings in a launched Wayfair market are actionable. Non-active # or out-of-market candidates (reachable via open_issue_item_ids) return [] so # the sync auto-resolves stale issues once the item is discontinued or the # market is wound down. return [] unless catalog_item.state == 'active' return [] unless market_catalog_ids.include?(catalog_item.catalog_id) [ not_synced_issue(catalog_item), not_live_issue(catalog_item), duplicate_parent_products_issue(catalog_item), class_desired_mismatch_issue(catalog_item), *missing_required_spec_issues(catalog_item), *insights_issues(catalog_item) ].compact end |
#provider ⇒ String
59 |
# File 'app/services/listing_issues/wayfair_adapter.rb', line 59 def provider = PROVIDER |