Class: Skydrive::File
Overview
The file object
Instance Attribute Summary
Attributes inherited from Object
Instance Method Summary collapse
-
#comments_count ⇒ Integer
The number of comments associated with the file.
-
#comments_enabled? ⇒ Boolean
A value that indicates whether comments are enabled for the file.
-
#download ⇒ Object
Download the file.
-
#download_link ⇒ String
The link that can be used to download the file.
-
#size ⇒ String
The file size.
-
#source ⇒ String
The URL to use to download the file from SkyDrive.
Methods inherited from Object
#comment, #comments, #created_time, #delete, #description, #from, #id, #initialize, #is_embeddable?, #link, #name, #parent_id, #shared_with, #to_hash, #to_json, #type, #updated_time, #upload_location
Constructor Details
This class inherits a constructor from Skydrive::Object
Instance Method Details
#comments_count ⇒ Integer
The number of comments associated with the file
13 14 15 |
# File 'lib/skydrive/file.rb', line 13 def comments_count object["comments_count"] end |
#comments_enabled? ⇒ Boolean
A value that indicates whether comments are enabled for the file
19 20 21 |
# File 'lib/skydrive/file.rb', line 19 def comments_enabled? object["comments_enabled"] end |
#download ⇒ Object
Download the file
36 37 38 39 40 |
# File 'lib/skydrive/file.rb', line 36 def download uri = URI(download_link) response = HTTParty.get("http://#{uri.host}#{uri.path}?#{uri.query}") response.parsed_response end |
#download_link ⇒ String
The link that can be used to download the file
31 32 33 |
# File 'lib/skydrive/file.rb', line 31 def download_link url = client.get("/#{id}/content", :download => true, :suppress_redirects => true)["location"] end |
#size ⇒ String
The file size
7 8 9 |
# File 'lib/skydrive/file.rb', line 7 def size object["size"] end |
#source ⇒ String
The URL to use to download the file from SkyDrive
25 26 27 |
# File 'lib/skydrive/file.rb', line 25 def source object["source"] end |