Class: Skydrive::Object
- Inherits:
-
Object
- Object
- Skydrive::Object
- Defined in:
- lib/skydrive/object.rb
Overview
The base class for all objects
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
-
#comment(options = {}) ⇒ Object
Make a comment about the object.
-
#comments ⇒ Skydrive::Collection
Comments associated with the object.
-
#created_time ⇒ Time
The time at which the object was created.
-
#delete ⇒ Object
Delete the object from Skydrive.
-
#description ⇒ String
Desciption of the object.
-
#from ⇒ Skydrive::User
Info about the user who uploaded the file.
-
#id ⇒ String
ID of the object.
-
#initialize(client, data) ⇒ Object
constructor
A new instance of Object.
-
#is_embeddable? ⇒ Boolean
A value that indicates whether this object can be embedded.
-
#link ⇒ String
A URL to view the item on SkyDrive.
-
#name ⇒ String
Name of the object.
-
#parent_id ⇒ String
The ID of the parent object.
-
#shared_with ⇒ Hash
The object that contains permission info.
-
#to_hash ⇒ Hash
Get the hash equivalent of the data.
-
#to_json ⇒ String
Get json format object.
-
#type ⇒ String
Type of object.
-
#updated_time ⇒ Time
The time at which the object was updated.
-
#upload_location ⇒ String
The URL to upload file content hosted in SkyDrive.
Constructor Details
#initialize(client, data) ⇒ Object
Returns a new instance of Object.
5 6 7 8 |
# File 'lib/skydrive/object.rb', line 5 def initialize client, data @client = client @object = data end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
4 5 6 |
# File 'lib/skydrive/object.rb', line 4 def client @client end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
4 5 6 |
# File 'lib/skydrive/object.rb', line 4 def object @object end |
Instance Method Details
#comment(options = {}) ⇒ Object
Make a comment about the object
108 109 110 |
# File 'lib/skydrive/object.rb', line 108 def comment ={} client.post("/#{id}/comments", ) end |
#comments ⇒ Skydrive::Collection
Comments associated with the object
101 102 103 |
# File 'lib/skydrive/object.rb', line 101 def comments client.get("/#{id}/comments") end |
#created_time ⇒ Time
The time at which the object was created.
48 49 50 |
# File 'lib/skydrive/object.rb', line 48 def created_time Time.parse(object["created_time"]) if object["created_time"] end |
#delete ⇒ Object
Delete the object from Skydrive
89 90 91 |
# File 'lib/skydrive/object.rb', line 89 def delete client.delete("/#{id}") end |
#description ⇒ String
Desciption of the object
30 31 32 |
# File 'lib/skydrive/object.rb', line 30 def description object["description"] end |
#from ⇒ Skydrive::User
Info about the user who uploaded the file.
18 19 20 |
# File 'lib/skydrive/object.rb', line 18 def from Skydrive::User.new(client, object["from"]) if object["from"] end |
#id ⇒ String
ID of the object
12 13 14 |
# File 'lib/skydrive/object.rb', line 12 def id object["id"] end |
#is_embeddable? ⇒ Boolean
A value that indicates whether this object can be embedded
95 96 97 |
# File 'lib/skydrive/object.rb', line 95 def object["is_embeddable"] end |
#link ⇒ String
A URL to view the item on SkyDrive
42 43 44 |
# File 'lib/skydrive/object.rb', line 42 def link object["link"] end |
#name ⇒ String
Name of the object
24 25 26 |
# File 'lib/skydrive/object.rb', line 24 def name object["name"] end |
#parent_id ⇒ String
The ID of the parent object
66 67 68 |
# File 'lib/skydrive/object.rb', line 66 def parent_id object["parent_id"] end |
#shared_with ⇒ Hash
The object that contains permission info.
72 73 74 |
# File 'lib/skydrive/object.rb', line 72 def shared_with object["shared_with"] end |
#to_hash ⇒ Hash
Get the hash equivalent of the data
84 85 86 |
# File 'lib/skydrive/object.rb', line 84 def to_hash object end |
#to_json ⇒ String
Get json format object
78 79 80 |
# File 'lib/skydrive/object.rb', line 78 def to_json object.to_json end |
#type ⇒ String
Type of object
36 37 38 |
# File 'lib/skydrive/object.rb', line 36 def type object["type"] end |
#updated_time ⇒ Time
The time at which the object was updated.
54 55 56 |
# File 'lib/skydrive/object.rb', line 54 def updated_time Time.parse(object["updated_time"]) if object["updated_time"] end |
#upload_location ⇒ String
The URL to upload file content hosted in SkyDrive.
60 61 62 |
# File 'lib/skydrive/object.rb', line 60 def upload_location object["upload_location"] end |