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, #properties
Instance Method Summary
collapse
Methods inherited from Object
#==, #[], #each, #eql?, #fetch_deferred, #initialize, #to_h, #to_json
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 = Addressable::URI.encode(self['ServerRelativeUrl'])
url.to_s
end
|