Class: Feed::ItemPresenter

Inherits:
BasePresenter show all
Defined in:
app/services/feed/item_presenter.rb

Instance Attribute Summary

Attributes inherited from BasePresenter

#current_account, #options, #url_helper

Instance Method Summary collapse

Methods inherited from BasePresenter

#can?, #capture, #concat, #content_tag, #fa_icon, #h, #initialize, #link_to, #number_to_currency, #present, presents, #r, #safe_present, #simple_format, #u

Constructor Details

This class inherits a constructor from BasePresenter

Instance Method Details

#all_imagesObject



9
10
11
# File 'app/services/feed/item_presenter.rb', line 9

def all_images
  r.image_profiles.website_image_profiles_excluding_card.image_order.includes(:image).map(&:image)
end

#catalog_itemsObject



21
22
23
# File 'app/services/feed/item_presenter.rb', line 21

def catalog_items
  r.catalog_items.available_for_edi_feeds
end

#google_product_category_idObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/services/feed/item_presenter.rb', line 25

def google_product_category_id
  slt = primary_product_line&.slug_ltree.to_s
  pc_url = product_category&.url
  return 1897   if pc_url =~ /thermostats/ # Hardware  | Heating, Ventilation & Air Conditioning  | HVAC Controls  | Thermostats
  return 1519   if pc_url =~ /controls/ || slt.start_with?('floor_heating.control.integration') # Hardware  | Heating, Ventilation & Air Conditioning  | HVAC Controls
  return 2729   if slt.start_with?('countertop_heater') && pc_url =~ /heating-elements/ # Hardware	Building Materials	Countertops
  return 499873 if slt.start_with?('floor_heating') #| Hardware  | Heating, Ventilation & Air Conditioning
  return 595    if slt.start_with?('led_mirror', 'mirror_defogger') # Home & Garden	Decor	Mirrors
  return 2060   if slt.start_with?('radiant_panel')  #| Home & Garden  | Household Appliances  | Climate Control Appliances  | Heating Radiators
  return 4544   if slt.start_with?('roof_gutter_deicing') #Hardware	Building Materials	Roofing	Gutter Accessories
  return 5362   if slt.start_with?('snow_melting') #	Home & Garden	Lawn & Garden	Snow Removal
  return 586    if slt.start_with?('towel_warmer') #| Home & Garden  | Bathroom Accessories  | Towel Racks & Holders
  return 122	  if pc_url =~ /insulation/ #  Hardware	Building Materials	Insulation
  return 115    #	Hardware > Building Materials
end

#product_typeObject



41
42
43
# File 'app/services/feed/item_presenter.rb', line 41

def product_type
  Feed::ProductTypeGenerator.process(item: r)
end

#public_specificationsObject



17
18
19
# File 'app/services/feed/item_presenter.rb', line 17

def public_specifications
  r.rendered_product_specifications.select{|k,v| v[:visibility] != 'private' }
end

#seo_keywordsObject



5
6
7
# File 'app/services/feed/item_presenter.rb', line 5

def seo_keywords
  r.seo_keywords.presence || product_line_page_keywords(r.primary_product_line)
end

#videosObject



13
14
15
# File 'app/services/feed/item_presenter.rb', line 13

def videos
  Item::VideoRetriever.new(tags: 'for-product-page').process(item).all_videos
end