Class: ListingIssues::GoogleAdapter
- Inherits:
-
BaseAdapter
- Object
- BaseAdapter
- ListingIssues::GoogleAdapter
- Defined in:
- app/services/listing_issues/google_adapter.rb
Overview
Google Merchant Center listing issues, derived from the Merchant API
product_view report our daily pull persists onto
catalog_item.google_report (Feed::Google::MerchantApi::ReportPuller →
GoogleMerchantReportSyncWorker). Reads stored data only — never calls the
Merchant API — so it can't block on the API and stays consistent with
whatever the last pull recorded. Mirrors WayfairAdapter; registered in
Sync.adapters.
An item with aggregatedReportingContextStatus == 'ELIGIBLE' (or no
report yet) reports nothing — it's fully serving, nothing to flag.
ponytail: severity is derived from the item-level status, not a per-issue
severity field. The Merchant API's itemIssues[].severity shape was never
observed live (2026-07-29: the account has zero non-ELIGIBLE products, so
there's nothing to inspect) — the migration doc only confirmed
itemIssues[].type = {code, canonicalAttribute}. Guessing an unverified
field/enum name would violate "source claims with evidence"; a status
that contains "DISAPPROV" is a hard block (error), anything else
non-ELIGIBLE (e.g. ELIGIBLE_LIMITED) still serves (warning) — matches
ListingIssue's own error/warning definitions. Revisit once a real
non-ELIGIBLE product with item_issues is observed live.
Constant Summary collapse
- PROVIDER =
Provider key stamped on issues produced by this adapter.
'google'
Instance Method Summary collapse
-
#candidate_item_ids ⇒ Array<Integer>
Items with a persisted non-ELIGIBLE report, plus any item already carrying an open Google issue (so a status that flips back to ELIGIBLE auto-resolves on the next run).
- #issues_for(catalog_item) ⇒ Array<ListingIssues::Issue>
- #provider ⇒ String
Methods inherited from BaseAdapter
Instance Method Details
#candidate_item_ids ⇒ Array<Integer>
Items with a persisted non-ELIGIBLE report, plus any item already
carrying an open Google issue (so a status that flips back to ELIGIBLE
auto-resolves on the next run).
38 39 40 |
# File 'app/services/listing_issues/google_adapter.rb', line 38 def candidate_item_ids (reported_item_ids + open_issue_item_ids).uniq end |
#issues_for(catalog_item) ⇒ Array<ListingIssues::Issue>
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/services/listing_issues/google_adapter.rb', line 44 def issues_for(catalog_item) report = catalog_item.google_report return [] unless report.is_a?(Hash) status = report['status'].to_s return [] if status.blank? || status == 'ELIGIBLE' severity = status.include?('DISAPPROV') ? 'error' : 'warning' item_issues = Array(report['item_issues']) return [status_issue(status, severity)] if item_issues.empty? item_issues.filter_map { |issue| issue_for(issue, status, severity) } end |
#provider ⇒ String
32 |
# File 'app/services/listing_issues/google_adapter.rb', line 32 def provider = PROVIDER |