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



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

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

#initObject



146
147
148
149
# File 'lib/oddb2xml/downloader.rb', line 146

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