Class: ActiveCMIS::Relationship

Inherits:
Object
  • Object
show all
Defined in:
lib/active_cmis/relationship.rb

Instance Attribute Summary

Attributes inherited from Object

#key, #repository, #updated_attributes

Instance Method Summary collapse

Methods inherited from Object

#acl, #allowable_actions, #attribute, attributes, #attributes, #destroy, #file, from_atom_entry, from_parameters, #id, #initialize, #inspect, key, #method_missing, #name, #reload, #save, #source_relations, #target_relations, #unfile

Methods included from Internal::Caching

included

Constructor Details

This class inherits a constructor from ActiveCMIS::Object

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveCMIS::Object

Instance Method Details

#deletevoid

This method returns an undefined value.

Remove the relationship



17
18
19
# File 'lib/active_cmis/relationship.rb', line 17

def delete
  conn.delete(self_link)
end

#parent_foldersArray()

Return [], a relationship is not fileable

Returns:

  • (Array())


40
41
42
# File 'lib/active_cmis/relationship.rb', line 40

def parent_folders
  []
end

#sourceObject

Returns:



4
5
6
# File 'lib/active_cmis/relationship.rb', line 4

def source
  Internal::Utils.string_or_id_to_object(repository, attribute("cmis:sourceId"))
end

#targetObject

Returns:



10
11
12
# File 'lib/active_cmis/relationship.rb', line 10

def target
  Internal::Utils.string_or_id_to_object(repository, attribute("cmis:targetId"))
end

#update(updates = {}) ⇒ void

This method returns an undefined value.

Parameters:

  • attributes ({String => ::Object})

    A hash with new values for selected attributes

See Also:



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/active_cmis/relationship.rb', line 24

def update(updates = {})
  super
  # Potentially necessary if repositories support it
  # Probably not though

  # Note: we use remove_instance_variable because of the way I implemented the caching
  if updates["cmis:sourceId"] && instance_variable_defined?("@source")
    remove_instance_variable "@source"
  end
  if updates["cmis:targetId"] && instance_variable_defined?("@target")
    remove_instance_variable "@target"
  end
end