lib/geoblacklight/download.rb
##
# Initiates download from a remote source url using the `request_params`.
# Will catch Faraday::ConnectionFailed and
# Faraday::TimeoutError
# @return [Faraday::Request] returns a Faraday::Request object
Initiates download from a remote source url using the `request_params`.
Initiates download from a remote source url using the ` request_params ` .
def initiate_download
      conn = Faraday.new(url: url)
      conn.get do |request|
        request.params = @options[:request_params]
        request.options.timeout = timeout
        request.options.open_timeout = timeout
      end
    rescue Faraday::ConnectionFailed
      raise Geoblacklight::Exceptions::ExternalDownloadFailed,
            message: 'Download connection failed',
            url: conn.url_prefix.to_s
    rescue Faraday::TimeoutError
      raise Geoblacklight::Exceptions::ExternalDownloadFailed,
            message: 'Download timed out',
            url: conn.url_prefix.to_s
    end
def initiate_download conn = Faraday . new ( url : url ) conn . get do | request | request . params = @options [ :request_params ] request . options . timeout = timeout request . options . open_timeout = timeout end rescue Faraday :: ConnectionFailed raise Geoblacklight :: Exceptions :: ExternalDownloadFailed , message : 'Download connection failed' , url : conn . url_prefix . to_s rescue Faraday :: TimeoutError raise Geoblacklight :: Exceptions :: ExternalDownloadFailed , message : 'Download timed out' , url : conn . url_prefix . to_s end
Initiates download from a remote source url using the `request_params`.
Initiates download from a remote source url using the ` request_params ` .
returns a Faraday::Request object
returns a Faraday :: Request object
Faraday::Request