Class: Feed::OpenaiAds::ProductPresenter

Inherits:
Google::GoogleProductPresenter
  • Object
show all
Defined in:
app/services/feed/openai_ads/product_presenter.rb

Overview

Presents a catalog item as a row in the OpenAI Ads product feed.

OpenAI's Ads product feed is Google-Merchant-Center-shaped, so this reuses the
maintained Google::GoogleProductPresenter field logic wholesale and
adds only what the advertising feed needs on top:

  • #ads_eligible? — backs OpenAI's canonical is_ads_eligible flag; true
    for products we intend to advertise (the Shopping-feed gate: new,
    in-stock-able, has shipping dimensions + imagery, not dealer-channel-only).
  • #feed_includable? — looser gate (drops the image requirement) used to
    decide which products appear in the file at all, so a sellable product
    missing imagery is still listed but flagged is_ads_eligible=false.
  • #additional_image_link — collapses the image list to a single
    comma-joined cell for CSV output.

Adapted from the dropped Feed::Openai::OpenaiProductPresenter (the Agentic
Commerce / Instant-Checkout feed OpenAI retired in March 2026). That presenter
targeted the checkout spec (enable_checkout / seller_tos / q_and_a / geo_price);
this one targets the advertising spec and inherits its catalog mapping from the
Google presenter rather than re-deriving it.

Instance Method Summary collapse

Instance Method Details

GMC permits repeated additional_image_link values; a CSV feed carries them
as a single comma-joined cell.



39
40
41
# File 'app/services/feed/openai_ads/product_presenter.rb', line 39

def additional_image_link
  additional_image_links.join(',').presence
end

#ads_eligible?Boolean

Whether the product is eligible to advertise — backs the is_ads_eligible
column. Same gate as the Google Shopping feed (requires product imagery).

Returns:

  • (Boolean)


26
27
28
# File 'app/services/feed/openai_ads/product_presenter.rb', line 26

def ads_eligible?
  valid_for_google?(include_image_check: true)
end

#descriptionObject



51
52
53
# File 'app/services/feed/openai_ads/product_presenter.rb', line 51

def description
  Heatwave::Normalizers.strip_legal_marks(super)
end

#feed_includable?Boolean

Whether the product should appear in the feed file at all. Looser than
#ads_eligible? — a sellable, correctly-dimensioned product with no imagery
is still listed (flagged is_ads_eligible=false) rather than dropped.

Returns:

  • (Boolean)


33
34
35
# File 'app/services/feed/openai_ads/product_presenter.rb', line 33

def feed_includable?
  valid_for_google?(include_image_check: false)
end

#titleObject

Strip legal/IP glyphs (™ ® © …) from the human-readable fields: they add
nothing for ad matching/display and render as mojibake in some spreadsheet
viewers. Measurement symbols (e.g. 275′, 120°F) are preserved, and the Google
Shopping feed — which keeps the glyphs — is untouched.



47
48
49
# File 'app/services/feed/openai_ads/product_presenter.rb', line 47

def title
  Heatwave::Normalizers.strip_legal_marks(super)
end