Module: EasyDownloader::Http

Included in:
AbstractLoader
Defined in:
lib/easy_downloader/http.rb

Instance Method Summary collapse

Instance Method Details

#http_download(options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/easy_downloader/http.rb', line 3

def http_download(options)
  #result = options.result
  #result.started
  #Net::SFTP.start(options.host,
  #                options.user,
  #                password_option(options.password)) do |sftp|

  #  files = sftp.dir.glob(options.remote_path, options.remote_pattern)
  #  total = files.size
  #  result.found(files.size, files.map(&:name))

  #  files.map(&:name).each do |path|
  #    result.starting_path(path)
  #    download_count += 1 if sftp.download!("#{options.remote_path}#{path}", "#{options.destination_dir}#{path}")
  #    result.finished_path(path)
  #    files_downloaded << "#{options.destination_dir}#{path}"
  #  end
  #end

  #result.downloaded(download_count)
  #result.finished
end

#password_option(password) ⇒ Object



26
27
28
29
30
# File 'lib/easy_downloader/http.rb', line 26

def password_option(password)
  password ?
    {:password => password} :
    Hash.new
end