Class: Hyrax::ControlledVocabulary::Importer::Downloader

Inherits:
Object
  • Object
show all
Defined in:
lib/hyrax/controlled_vocabulary/importer/downloader.rb

Class Method Summary collapse

Class Method Details

.fetch(url, output) ⇒ Object


7
8
9
10
11
12
13
# File 'lib/hyrax/controlled_vocabulary/importer/downloader.rb', line 7

def self.fetch(url, output)
  open(url) do |io|
    IO.copy_stream(io, output)
  end
rescue OpenURI::HTTPError => e
  raise "Unable to download from #{url}\n#{e.message}: #{e.io.read}"
end