Sha256: e893365499dba3cf0244d7733fe2e7a0aecc3e82847ed42b34692db83f8e1cc3
Contents?: true
Size: 1023 Bytes
Versions: 1
Compression:
Stored size: 1023 Bytes
Contents
module Egnyte class Client def file(path) File::find(@session, path) end end class File < Item def download stream.read end def download_version(entry_id) stream(:entry_id => entry_id).read end # use opts to provide lambdas # to track the streaming download: # # :content_length_proc # :progress_proc def stream( opts={} ) file_content_path = "#{fs_path('fs-content')}#{Egnyte::Helper.normalize_path(path)}" file_content_path += "?entry_id=#{opts[:entry_id]}" if opts[:entry_id] @session.streaming_download(file_content_path, opts ) end def delete @session.delete("#{fs_path}#{path}") end def self.find(session, path) path = Egnyte::Helper.normalize_path(path) file = File.new({ 'path' => path }, session) parsed_body = session.get("#{file.fs_path}#{path}") raise FileExpected if parsed_body['is_folder'] file.update_data(parsed_body) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby-egnyte-0.1.6 | lib/egnyte/file.rb |