Posted about 7 years ago. Visible to the public.

Ruby: Downloading files

This is easy:

require 'open-uri''/target/path/to/downloaded.file', "wb") do |file| file.write open('').read end

Basic Authentication

When your file is protected by HTTP Basic Authentication, pass your credentials as hash:

Copy'/target/path/to/downloaded.file', "wb") do |file| file.write open('', :http_basic_authentication => [your_username, your_password]).read end

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for old versions of Ruby on Rails (3.2 and 2.3).

Owner of this card:

Dominik Schöler
Last edit:
over 2 years ago
by Dominik Schöler
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Dominik Schöler to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more