Class: Oddb2xml::BagXmlDownloader

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

Instance Attribute Summary

Attributes inherited from Downloader

#agent, #type

Instance Method Summary collapse

Methods inherited from Downloader

#initialize

Constructor Details

This class inherits a constructor from Oddb2xml::Downloader

Instance Method Details

#downloadObject



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/oddb2xml/downloader.rb', line 184

def download
  file = File.join(WorkDir, 'XMLPublications.zip')
  Oddb2xml.log "BagXmlDownloader #{__LINE__}: #{file}"
  unless Oddb2xml.skip_download(file)
    Oddb2xml.log "BagXmlDownloader #{__LINE__}: #{file}"
    begin
      response = @agent.get(@url)
      response.save_as(file)
      response = nil # win
    rescue Timeout::Error, Errno::ETIMEDOUT
      retrievable? ? retry : raise
    ensure
      Oddb2xml.download_finished(file)
    end
  end
  content = read_xml_from_zip(/Preparations.xml/, File.join(Downloads, File.basename(file)))
  FileUtils.rm_f(file, :verbose => false) unless defined?(RSpec)
  content
end

#initObject



180
181
182
183
# File 'lib/oddb2xml/downloader.rb', line 180

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