lib/bukin/utils.rb in bukin-0.3.0 vs lib/bukin/utils.rb in bukin-0.4.0

- old
+ new

@@ -1,15 +1,16 @@ +require 'bukin/version' require 'open-uri' def save_download(data, name, path) FileUtils.mkdir_p(path) open("#{path}/#{name}", "wb") do |file| file.print data end end def download_file(url, content_disposition = false) - open(url) do |download| + open(url, "User-Agent" => "Bukin #{Bukin::VERSION}") do |download| file_name = if download.meta['content-disposition'] download.meta['content-disposition'] .match(/filename=(\"?)(.+)\1/)[2] .force_encoding("UTF-8") else