Class: Grendel::LinkedDocument
- Defined in:
- lib/grendel/linked_document.rb
Instance Attribute Summary collapse
-
#linked_user ⇒ Object
Returns the value of attribute linked_user.
-
#owner ⇒ Object
Returns the value of attribute owner.
Attributes inherited from Document
#content_type, #data, #name, #uri, #user
Instance Method Summary collapse
-
#delete ⇒ Object
delete this linked document.
-
#initialize(linked_user, params) ⇒ LinkedDocument
constructor
create a new linked document user - linked user params: :name => document name :uri => linked document uri :owner => { :id => owner id :uri => owner uri }.
Methods inherited from Document
Constructor Details
#initialize(linked_user, params) ⇒ LinkedDocument
create a new linked document user - linked user params: :name => document name :uri => linked document uri :owner =>
:id => owner id
:uri => owner uri
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/grendel/linked_document.rb', line 14 def initialize(linked_user, params) params = Mash.new(params) @owner = User.new(linked_user.client, params[:owner]) super(@owner, params) @linked_user = linked_user @name = params[:name] @uri = params[:uri] ? URI.parse(params[:uri]).path : ["/linked-documents", @owner.id, name].join("/") end |
Instance Attribute Details
#linked_user ⇒ Object
Returns the value of attribute linked_user.
3 4 5 |
# File 'lib/grendel/linked_document.rb', line 3 def linked_user @linked_user end |
#owner ⇒ Object
Returns the value of attribute owner.
3 4 5 |
# File 'lib/grendel/linked_document.rb', line 3 def owner @owner end |
Instance Method Details
#delete ⇒ Object
delete this linked document
26 27 28 |
# File 'lib/grendel/linked_document.rb', line 26 def delete @linked_user.delete(@uri) end |