Class: IERS::Downloader
- Inherits:
-
Object
- Object
- IERS::Downloader
- Defined in:
- lib/iers/downloader.rb
Constant Summary collapse
- MAX_REDIRECTS =
5
Instance Method Summary collapse
- #fetch(url, dest_path) ⇒ Object
-
#initialize(timeout:) ⇒ Downloader
constructor
A new instance of Downloader.
Constructor Details
#initialize(timeout:) ⇒ Downloader
Returns a new instance of Downloader.
11 12 13 |
# File 'lib/iers/downloader.rb', line 11 def initialize(timeout:) @timeout = timeout end |
Instance Method Details
#fetch(url, dest_path) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/iers/downloader.rb', line 15 def fetch(url, dest_path) dest_path = Pathname(dest_path) dest_path.dirname.mkpath body = http_get(url) validate!(body, dest_path) atomic_write(dest_path, body) end |