Class: Sharepoint::File

Inherits:
Object show all
Includes:
Type
Defined in:
lib/sharepoint-files.rb

Instance Attribute Summary

Attributes inherited from Object

#parent

Attributes inherited from ObjectProperties

#data, #site, #updated_data

Instance Method Summary collapse

Methods included from Type

#initialize

Methods inherited from Object

#copy, #destroy, #guid, #initialize, #reload, #save

Methods inherited from ObjectProperties

#add_properties, #add_property, #available_properties, #initialize

Instance Method Details

#download_to_file(filename) ⇒ Object


57
58
59
60
61
62
# File 'lib/sharepoint-files.rb', line 57

def download_to_file filename
  content = download
  ::File.open filename, "w:#{content.encoding.name}" do |file|
    file.write content
  end
end

#upload_from_file(filename) ⇒ Object


48
49
50
51
52
53
54
55
# File 'lib/sharepoint-files.rb', line 48

def upload_from_file filename
  content = String.new
  ::File.open filename, 'rb' do |file|
    line = nil
    content += line while line = file.gets
  end
  upload content
end