Class: Oddb2xml::BagXmlDownloader

Inherits:
Downloader show all
Includes:
DownloadMethod
Defined in:
lib/oddb2xml/downloader.rb

Instance Attribute Summary

Attributes inherited from Downloader

#agent, #file2save, #type, #url

Instance Method Summary collapse

Methods inherited from Downloader

#initialize, #report_download

Constructor Details

This class inherits a constructor from Oddb2xml::Downloader

Instance Method Details

#downloadObject



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/oddb2xml/downloader.rb', line 220

def download
  file = File.join(WORK_DIR, "XMLPublications.zip")
  download_as(file)
  report_download(@url, file)
  if defined?(RSpec)
    src = File.join(Oddb2xml::SpecData, "Preparations.xml")
    content = File.read(src)
    FileUtils.cp(src, File.join(DOWNLOADS, File.basename(file)))
  else
    content = read_xml_from_zip(/Preparations.xml/, File.join(DOWNLOADS, File.basename(file)))
  end
  if @options[:artikelstamm]
    cmd = "xmllint --format --output Preparations.xml Preparations.xml"
    Oddb2xml.log(cmd)
    system(cmd)
  end
  FileUtils.rm_f(file, verbose: false) unless defined?(RSpec)
  content
end

#initObject



215
216
217
218
# File 'lib/oddb2xml/downloader.rb', line 215

def init
  super
  @url ||= "http://www.xn--spezialittenliste-yqb.ch/File.axd?file=XMLPublications.zip"
end