Class: Feed::Google::MerchantUploader

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/feed/google/merchant_uploader.rb

Defined Under Namespace

Classes: Result

Instance Method Summary collapse

Instance Method Details

#output_to_file(catalog) ⇒ Object



19
20
21
22
23
24
25
# File 'app/services/feed/google/merchant_uploader.rb', line 19

def output_to_file(catalog)
  file_name = "gm_wy_#{catalog.id}.xml"
  local_file_path = Rails.root.join('public',file_name)
  logger.info "Creating google merchant product data xml at #{local_file_path}"
  res = Feed::Google::ListGenerator.new.process catalog: catalog, output_file_path: local_file_path
  local_file_path
end

#process(catalogs: nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'app/services/feed/google/merchant_uploader.rb', line 7

def process(catalogs: nil)
  catalogs ||= Catalog.main_catalogs
  files = []
  catalogs.each do |catalog|
    local_file_path = output_to_file(catalog)
    files << local_file_path
    # Transmit
    # res = transmit(local_file_path)
  end
  files
end