Class: CMIS::Policy

Inherits:
Object show all
Defined in:
lib/cmis/policy.rb

Instance Attribute Summary collapse

Attributes inherited from Object

#properties, #repository

Instance Method Summary collapse

Methods inherited from Object

#acls, #add_aces, #allowable_actions, #delete, #delete_with_relationships, #detached?, #inspect, #move, #object_type, #parents, #policies, #refresh, #relationships, #remove_aces, #unfile, #update_properties

Methods included from Helpers

#cmis_properties, #initialize_properties, #method_missing, #respond_to?, #with_change_token

Constructor Details

#initialize(raw, repository) ⇒ Policy

Returns a new instance of Policy


5
6
7
8
# File 'lib/cmis/policy.rb', line 5

def initialize(raw, repository)
  super
  cmis_properties %w( cmis:policyText )
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CMIS::Helpers

Instance Attribute Details

#policy_textObject (readonly)

Returns the value of attribute policy_text


3
4
5
# File 'lib/cmis/policy.rb', line 3

def policy_text
  @policy_text
end

Instance Method Details

#apply_to(object, opts = {}) ⇒ Object


10
11
12
13
14
15
# File 'lib/cmis/policy.rb', line 10

def apply_to(object, opts = {})
  server.execute!({ cmisaction: 'applyPolicy',
                    repositoryId: repository_id,
                    policyId: cmis_object_id,
                    objectId: object.cmis_object_id }, opts)
end

#remove_from(object, opts = {}) ⇒ Object


17
18
19
20
21
22
# File 'lib/cmis/policy.rb', line 17

def remove_from(object, opts = {})
  server.execute!({ cmisaction: 'removePolicy',
                    repositoryId: repository_id,
                    policyId: cmis_object_id,
                    objectId: object.cmis_object_id }, opts)
end