Class: Spree::DataFeeds::GooglePresenter

Inherits:
BasePresenter show all
Defined in:
app/presenters/spree/data_feeds/google_presenter.rb

Constant Summary collapse

OPTIONAL_ATTRIBUTES =

Optional Google Merchant Center product attributes sourced from metafields. See https://support.google.com/merchants/answer/7052112

%w[
  brand gtin mpn identifier_exists condition adult multipack is_bundle
  age_group color gender material pattern size size_type size_system
  product_length product_width product_height product_weight
  google_product_category product_type sale_price sale_price_effective_date
  cost_of_goods_sold unit_pricing_measure unit_pricing_base_measure
  shipping shipping_label shipping_weight shipping_length shipping_width
  shipping_height ships_from_country transit_time_label max_handling_time
  min_handling_time tax tax_category energy_efficiency_class
  min_energy_efficiency_class max_energy_efficiency_class
  gtin_source expiration_date custom_label_0 custom_label_1 custom_label_2
  custom_label_3 custom_label_4 mobile_link additional_image_link
].freeze

Instance Attribute Summary

Attributes inherited from BasePresenter

#data_feed, #store

Instance Method Summary collapse

Methods inherited from BasePresenter

#initialize

Constructor Details

This class inherits a constructor from Spree::DataFeeds::BasePresenter

Instance Method Details

#callString

Returns RSS XML feed for Google Merchant Center.

Returns:

  • (String)

    RSS XML feed for Google Merchant Center



23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/presenters/spree/data_feeds/google_presenter.rb', line 23

def call
  builder = Nokogiri::XML::Builder.new do |xml|
    xml.rss('xmlns:g' => 'http://base.google.com/ns/1.0', 'version' => '2.0') do
      xml.channel do
        build_store_info(xml)
        build_items(xml)
      end
    end
  end

  builder.to_xml
end