Class: Grendel::Document
- Inherits:
-
Object
- Object
- Grendel::Document
- Defined in:
- lib/grendel/document.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#data ⇒ Object
Returns the value of attribute data.
-
#name ⇒ Object
Returns the value of attribute name.
-
#uri ⇒ Object
Returns the value of attribute uri.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#delete ⇒ Object
delete this document from Grendel.
-
#initialize(user, params) ⇒ Document
constructor
A new instance of Document.
-
#links ⇒ Object
send link operations to the Link class.
Constructor Details
#initialize(user, params) ⇒ Document
Returns a new instance of Document.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/grendel/document.rb', line 5 def initialize(user, params) params = Mash.new(params) @user = user @client = user.client @name = params[:name] @data = params[:data] @content_type = params[:content_type] @uri = params[:uri] ? URI.parse(params[:uri]).path : "/documents/" + @name # escape this? end |
Instance Attribute Details
#content_type ⇒ Object
Returns the value of attribute content_type.
3 4 5 |
# File 'lib/grendel/document.rb', line 3 def content_type @content_type end |
#data ⇒ Object
Returns the value of attribute data.
3 4 5 |
# File 'lib/grendel/document.rb', line 3 def data @data end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/grendel/document.rb', line 3 def name @name end |
#uri ⇒ Object
Returns the value of attribute uri.
3 4 5 |
# File 'lib/grendel/document.rb', line 3 def uri @uri end |
#user ⇒ Object
Returns the value of attribute user.
3 4 5 |
# File 'lib/grendel/document.rb', line 3 def user @user end |
Instance Method Details
#delete ⇒ Object
delete this document from Grendel
18 19 20 |
# File 'lib/grendel/document.rb', line 18 def delete @user.delete(@uri) end |
#links ⇒ Object
send link operations to the Link class
23 24 25 |
# File 'lib/grendel/document.rb', line 23 def links LinkManager.new(self) end |