9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/services/spree/data_feeds/google/rss.rb', line 9
def call(settings)
@settings = settings
return failure(store, error: "Store with id: #{settings.store_id} does not exist.") if store.nil?
builder = Nokogiri::XML::Builder.new do |xml|
xml.('xmlns:g' => 'http://base.google.com/ns/1.0', 'version' => '2.0') do
xml.channel do
add_store_information_to_xml(xml)
result = products_list.call(store)
if result.success?
result.value[:products].find_each do |product|
product.variants.active.find_each do |variant|
add_variant_information_to_xml(xml, product, variant)
end
end
end
end
end
end
success(file: builder.to_xml)
end
|