Class: Fig::Protocol::HTTP
- Inherits:
-
Object
- Object
- Fig::Protocol::HTTP
- Includes:
- Fig::Protocol
- Defined in:
- lib/fig/protocol/http.rb
Overview
File transfers via HTTP.
Instance Method Summary collapse
-
#download(uri, path, prompt_for_login) ⇒ Object
Returns whether the file was not downloaded because the file already exists and is already up-to-date.
Methods included from Fig::Protocol
#download_list, #path_up_to_date?, #upload
Instance Method Details
#download(uri, path, prompt_for_login) ⇒ Object
Returns whether the file was not downloaded because the file already exists and is already up-to-date.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fig/protocol/http.rb', line 20 def download(uri, path, prompt_for_login) log_download(uri, path) ::File.open(path, 'wb') do |file| file.binmode begin download_via_http_get(uri, file) rescue SystemCallError => error Fig::Logging.debug error. raise Fig::FileNotFoundError.new error., uri rescue SocketError => error Fig::Logging.debug error. raise Fig::FileNotFoundError.new error., uri end end end |