Class: Grendel::LinkedDocument

Inherits:
Document
  • Object
show all
Defined in:
lib/grendel/linked_document.rb

Instance Attribute Summary collapse

Attributes inherited from Document

#content_type, #data, #name, #uri, #user

Instance Method Summary collapse

Methods inherited from Document

#links

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_userObject

Returns the value of attribute linked_user.



3
4
5
# File 'lib/grendel/linked_document.rb', line 3

def linked_user
  @linked_user
end

#ownerObject

Returns the value of attribute owner.



3
4
5
# File 'lib/grendel/linked_document.rb', line 3

def owner
  @owner
end

Instance Method Details

#deleteObject

delete this linked document



26
27
28
# File 'lib/grendel/linked_document.rb', line 26

def delete
  @linked_user.delete(@uri)
end