Method: ActiveCMIS::Collection#destroy

Defined in:
lib/active_cmis/collection.rb

#destroy(options = {}) ⇒ Object

Attempts to delete the collection. This may not work on every collection, ActiveCMIS does not (yet) try to check this client side.

For folder collections 2 options are available, again no client side checking is done to see whether the collection can handle these options

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :unfileObjects (String)

    Parameter valid for items collection of folder “delete” (default): Delete all fileable objects “unfile”: unfile all fileable objects “deleteSingleFiled”: Delete all fileable objects, whose only parent folder is the current folder. Unfile all other objects from this folder

  • :continueOnFailure (Bool)

    default = false, if false abort on failure of single document/folder, else try to continue with deleting child folders/documents



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/active_cmis/collection.rb', line 153

def destroy(options = {})
  if options.empty?
    conn.delete(@url)
  else
    unfileObjects = options.delete(:unfileObjects)
    continueOnFailure = options.delete(:continueOnFailure)
    raise ArgumentError("Unknown parameters #{options.keys.join(', ')}") unless options.empty?


    # XXX: have less cumbersome code, more generic and more efficient code
    new_url = @url
    new_url = Internal::Utils.append_parameters(new_url, :unfileObjects => unfileObjects) unless unfileObjects.nil?
    new_url = Internal::Utils.append_parameters(new_url, :continueOnFailure => continueOnFailure) unless continueOnFailure.nil?

    # TODO: check that we can handle 200,202,204 responses correctly
    conn.delete(@url)
  end
end