class Flico::FetchImage

Public Instance Methods

call(url) click to toggle source
# File lib/flico/saver.rb, line 13
def call(url)
        tempfile = Tempfile.new 'temp_image'
        IO.copy_stream(open(url, read_timeout: 5), tempfile)
        tempfile.rewind
        tempfile
        rescue OpenURI::HTTPError => e
        raise FetchingError, "Couldn't download from: #{url} due to #{e.message}"
end