Sha256: bed0482dc49bb667e5d6b7b7bf30dc801cd1d4e801a33ec497a12ed35c92c825

Contents?: true

Size: 943 Bytes

Versions: 3

Compression:

Stored size: 943 Bytes

Contents

module EasyDownloader
  module Http
    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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
easy_downloader-0.1.1 lib/easy_downloader/http.rb
easy_downloader-0.1.0 lib/easy_downloader/http.rb
easy_downloader-0.0.3.alpha lib/easy_downloader/http.rb