Class: Oddb2xml::FirstbaseDownloader

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

Constant Summary collapse

BASE_URL =
"http://pillbox.oddb.org"

Instance Attribute Summary

Attributes inherited from Downloader

#agent, #file2save, #type, #url

Instance Method Summary collapse

Methods inherited from Downloader

#init, #report_download

Constructor Details

#initialize(type = :orphan, options = {}) ⇒ FirstbaseDownloader

Returns a new instance of FirstbaseDownloader.



352
353
354
# File 'lib/oddb2xml/downloader.rb', line 352

def initialize(type = :orphan, options = {})
  @url = BASE_URL + "/firstbase.xlsx"
end

Instance Method Details

#downloadObject



356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/oddb2xml/downloader.rb', line 356

def download
  @file2save = File.join(DOWNLOADS, "firstbase.xlsx")
  report_download(@url, @file2save)
  begin
    download_as(@file2save, "w+")
    return File.expand_path(@file2save)
  rescue Timeout::Error, Errno::ETIMEDOUT
    retrievable? ? retry : raise
  ensure
    Oddb2xml.download_finished(@file2save, false)
  end
  File.expand_path(@file2save)
end