Class: RestfulSharePoint::File
- Inherits:
-
Object
show all
- Defined in:
- lib/restful-sharepoint/objects/file.rb
Constant Summary
Constants inherited
from Object
Object::DEFAULT_OPTIONS
Instance Attribute Summary
Attributes inherited from Object
#connection, #options
Instance Method Summary
collapse
Methods inherited from Object
#fetch_deferred, #initialize, #method_missing, #properties, #properties=, #respond_to_missing?, #to_json, #values
Methods inherited from CommonBase
#objectify
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class RestfulSharePoint::Object
Instance Method Details
8
9
10
|
# File 'lib/restful-sharepoint/objects/file.rb', line 8
def content
@content ||= connection.get(url)
end
|
4
5
6
|
# File 'lib/restful-sharepoint/objects/file.rb', line 4
def endpoint
"#{@parent.endpoint}/File"
end
|
#extension ⇒ Object
31
32
33
|
# File 'lib/restful-sharepoint/objects/file.rb', line 31
def extension
self['ServerRelativeUrl'].rpartition('.').last
end
|
27
28
29
|
# File 'lib/restful-sharepoint/objects/file.rb', line 27
def filename
self['ServerRelativeUrl'].rpartition('/').last
end
|
23
24
25
|
# File 'lib/restful-sharepoint/objects/file.rb', line 23
def name
filename.rpartition('.').first
end
|
19
20
21
|
# File 'lib/restful-sharepoint/objects/file.rb', line 19
def size
self['Length'] || content.length
end
|
12
13
14
15
16
|
# File 'lib/restful-sharepoint/objects/file.rb', line 12
def url
url = URI.parse(connection.site_url)
url.path = URI.encode(self['ServerRelativeUrl'])
url.to_s
end
|