Class: Egnyte::File
Class Method Summary collapse
Instance Method Summary collapse
- #delete ⇒ Object
- #download ⇒ Object
-
#stream(opts = {}) ⇒ Object
use opts to provide lambdas to track the streaming download:.
Methods inherited from Item
#fs_path, #initialize, #method_missing, #update_data
Constructor Details
This class inherits a constructor from Egnyte::Item
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Egnyte::Item
Class Method Details
.find(session, path) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/egnyte/file.rb', line 21 def self.find(session, path) path = Egnyte::Helper.normalize_path(path) file = File.new({ 'path' => path }, session) parsed_body = session.get("#{file.fs_path}#{URI.escape(path)}") raise FileExpected if parsed_body['is_folder'] file.update_data(parsed_body) end |
Instance Method Details
#delete ⇒ Object
17 18 19 |
# File 'lib/egnyte/file.rb', line 17 def delete @session.delete("#{fs_path}/#{URI.escape(path)}") end |
#download ⇒ Object
4 5 6 |
# File 'lib/egnyte/file.rb', line 4 def download stream.read end |
#stream(opts = {}) ⇒ Object
use opts to provide lambdas to track the streaming download:
:content_length_proc :progress_proc
13 14 15 |
# File 'lib/egnyte/file.rb', line 13 def stream( opts={} ) @session.streaming_download( "#{fs_path('fs-content')}/#{URI.escape(path)}", opts ) end |