Class: Feed::Google::MerchantUploader

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

Overview

Service object: merchant uploader.

Defined Under Namespace

Classes: Result

Instance Method Summary collapse

Instance Method Details

#output_to_file(catalog) ⇒ Object



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

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

#process(catalogs: nil) ⇒ Object



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

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