lib/miteru/http_client.rb in miteru-0.9.6 vs lib/miteru/http_client.rb in miteru-0.10.0

- old
+ new

@@ -12,12 +12,11 @@ ctx = OpenSSL::SSL::SSLContext.new ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE @ssl_context = ctx end - def download(url, base_dir) - destination = download_path(base_dir, filename_to_save(url)) + def download(url, destination) down = Down::Http.new(default_options) { |client| client.headers(default_headers) } down.download(url, destination: destination) destination end @@ -48,18 +47,8 @@ { user_agent: DEFAULT_UA } end def default_options { ssl_context: ssl_context } - end - - def filename_to_save(url) - filename = url.split("/").last - extname = File.extname(filename) - "#{SecureRandom.alphanumeric}#{extname}" - end - - def download_path(base_dir, filename) - "#{base_dir}/#{filename}" end end end