Class: CMIS::Object
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Helpers
#cmis_properties, #initialize_properties, #method_missing, respond_to?, #update_change_token
Constructor Details
#initialize(raw, repository) ⇒ Object
Returns a new instance of Object.
8
9
10
11
12
13
14
15
16
|
# File 'lib/cmis/object.rb', line 8
def initialize(raw, repository)
initialize_properties(raw)
cmis_properties %w( cmis:objectId cmis:baseTypeId cmis:objectTypeId
cmis:secondaryObjectTypeIds cmis:name cmis:description
cmis:createdBy cmis:creationDate cmis:lastModifiedBy
cmis:lastModificationDate cmis:changeToken )
@repository = repository
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class CMIS::Helpers
Instance Attribute Details
#properties ⇒ Object
Returns the value of attribute properties.
6
7
8
|
# File 'lib/cmis/object.rb', line 6
def properties
@properties
end
|
#repository ⇒ Object
Returns the value of attribute repository.
5
6
7
|
# File 'lib/cmis/object.rb', line 5
def repository
@repository
end
|
Instance Method Details
#acls(opts = {}) ⇒ Object
87
88
89
90
91
|
# File 'lib/cmis/object.rb', line 87
def acls(opts = {})
connection.execute!({ cmisselector: 'acl',
repositoryId: repository.id,
objectId: cmis_object_id }, opts)
end
|
#add_aces(aces, opts = {}) ⇒ Object
93
94
95
96
97
98
|
# File 'lib/cmis/object.rb', line 93
def add_aces(aces, opts = {})
connection.execute!({ cmisaction: 'applyACL',
repositoryId: repository.id,
objectId: cmis_object_id,
addACEs: aces }, opts)
end
|
#allowable_actions(opts = {}) ⇒ Object
45
46
47
48
49
|
# File 'lib/cmis/object.rb', line 45
def allowable_actions(opts = {})
connection.execute!({ cmisselector: 'allowableActions',
repositoryId: repository.id,
objectId: cmis_object_id }, opts)
end
|
#delete(opts = {}) ⇒ Object
22
23
24
25
26
27
|
# File 'lib/cmis/object.rb', line 22
def delete(opts = {})
connection.execute!({ cmisaction: 'delete',
repositoryId: repository.id,
objectId: cmis_object_id,
allVersions: true }, opts)
end
|
#detached? ⇒ Boolean
107
108
109
|
# File 'lib/cmis/object.rb', line 107
def detached?
cmis_object_id.nil?
end
|
#move(target_folder, opts = {}) ⇒ Object
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/cmis/object.rb', line 73
def move(target_folder, opts = {})
object_parents = parents
unless object_parents.size == 1
raise 'Cannot move object because it is not in exactly one folder'
end
connection.execute!({ cmisaction: 'move',
repositoryId: repository.id,
objectId: cmis_object_id,
targetFolderId: target_folder.cmis_object_id,
sourceFolderId: object_parents.first.cmis_object_id }, opts)
end
|
#object_type(opts = {}) ⇒ Object
18
19
20
|
# File 'lib/cmis/object.rb', line 18
def object_type(opts = {})
repository.type(object_type_id, opts)
end
|
#parents(opts = {}) ⇒ Object
37
38
39
40
41
42
43
|
# File 'lib/cmis/object.rb', line 37
def parents(opts = {})
result = connection.execute!({ cmisselector: 'parents',
repositoryId: repository.id,
objectId: cmis_object_id }, opts)
result.map { |o| ObjectFactory.create(o['object'], repository) }
end
|
#policies(opts = {}) ⇒ Object
55
56
57
58
59
60
61
|
# File 'lib/cmis/object.rb', line 55
def policies(opts = {})
result = connection.execute!({ cmisselector: 'policies',
repositoryId: repository.id,
objectId: cmis_object_id }, opts)
result.map { |r| Policy.new(r, repository) }
end
|
#relationships(opts = {}) ⇒ Object
51
52
53
|
# File 'lib/cmis/object.rb', line 51
def relationships(opts = {})
Relationships.new(self, opts)
end
|
#remove_aces(aces, opts = {}) ⇒ Object
100
101
102
103
104
105
|
# File 'lib/cmis/object.rb', line 100
def remove_aces(aces, opts = {})
connection.execute!({ cmisaction: 'applyACL',
repositoryId: repository.id,
objectId: cmis_object_id,
removeACEs: aces }, opts)
end
|
#unfile(folder = nil, opts = {}) ⇒ Object
By default removes from all folders
64
65
66
67
68
69
70
71
|
# File 'lib/cmis/object.rb', line 64
def unfile(folder = nil, opts = {})
params = { repositoryId: repository.id,
cmisaction: 'removeObjectFromFolder',
objectId: cmis_object_id }
params.update!(folderId: folder.cmis_object_id) if folder
connection.execute!(params, opts)
end
|
#update_properties(properties, opts = {}) ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/cmis/object.rb', line 29
def update_properties(properties, opts = {})
update_change_token connection.execute!({ cmisaction: 'update',
repositoryId: repository.id,
objectId: cmis_object_id,
properties: properties,
changeToken: change_token }, opts)
end
|