Class: Oddb2xml::BagXmlDownloader

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

Instance Attribute Summary

Attributes inherited from Downloader

#agent, #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



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/oddb2xml/downloader.rb', line 202

def download
  file = File.join(WorkDir, '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



198
199
200
201
# File 'lib/oddb2xml/downloader.rb', line 198

def init
  super
  @url ||= 'http://bag.e-mediat.net/SL2007.Web.External/File.axd?file=XMLPublications.zip'
end