Class: Oddb2xml::BagXmlDownloader
- Inherits:
-
Downloader
- Object
- Downloader
- Oddb2xml::BagXmlDownloader
- 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
Constructor Details
This class inherits a constructor from Oddb2xml::Downloader
Instance Method Details
#download ⇒ Object
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/oddb2xml/downloader.rb', line 222 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: true) unless defined?(RSpec) content end |
#init ⇒ Object
217 218 219 220 |
# File 'lib/oddb2xml/downloader.rb', line 217 def init super @url ||= "http://www.spezialitaetenliste.ch/File.axd?file=XMLPublications.zip" end |