Class: Oddb2xml::BagXmlDownloader
Instance Attribute Summary
Attributes inherited from Downloader
#type
Instance Method Summary
collapse
Methods inherited from Downloader
#initialize
Instance Method Details
#download ⇒ Object
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
# File 'lib/oddb2xml/downloader.rb', line 156
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 end
end
inhalt = read_xml_form_zip(/^Preparation/iu, file)
if @options[:skip_download]
FileUtils.makedirs(Backup)
outfile = File.join(Backup, 'Preparations.xml')
Oddb2xml.log "Downloader saving outfile #{outfile} for #{self.class}"
File.open(outfile, 'w+') { |file| file.write inhalt}
end
inhalt
rescue Timeout::Error, Errno::ETIMEDOUT
retrievable? ? retry : raise
ensure
Oddb2xml.download_finished(file)
end
end
|
#init ⇒ Object
152
153
154
155
|
# File 'lib/oddb2xml/downloader.rb', line 152
def init
super
@url ||= 'http://bag.e-mediat.net/SL2007.Web.External/File.axd?file=XMLPublications.zip'
end
|