Class: Oddb2xml::BagXmlDownloader

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

Instance Method Summary collapse

Methods inherited from Downloader

#initialize

Constructor Details

This class inherits a constructor from Oddb2xml::Downloader

Instance Method Details

#downloadObject



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/oddb2xml/downloader.rb', line 153

def download
  file = 'XMLPublications.zip'
  begin
    if @options[:debug]
      FileUtils.copy(File.expand_path("../../../spec/data/#{file}", __FILE__), '.')
    else
      unless Oddb2xml.skip_download(file)
        response = @agent.get(@url)
        response.save_as(file)
        response = nil # win
      end
    end
    read_xml_form_zip(/^Preparation/iu, file)
  rescue Timeout::Error, Errno::ETIMEDOUT
    retrievable? ? retry : raise
  ensure
    Oddb2xml.download_finished(file)
  end
end

#initObject



149
150
151
152
# File 'lib/oddb2xml/downloader.rb', line 149

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