Class: Calligraphy::Move

Inherits:
Copy show all
Defined in:
lib/calligraphy/web_dav_request/move.rb

Overview

Responsible for copying a resource then deleting the original source.

Instance Attribute Summary

Attributes inherited from WebDavRequest

#headers, #request, #resource, #response

Instance Method Summary collapse

Methods inherited from WebDavRequest

#initialize

Constructor Details

This class inherits a constructor from Calligraphy::WebDavRequest

Instance Method Details

#executeObject

Executes the WebDAV request for a particular resource.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/calligraphy/web_dav_request/move.rb', line 7

def execute
  return :locked if @resource.locked_to_user? @headers

  if @resource.true? options[:overwrite]
    previous_resource_existed = overwrite_destination
  end

  status = super
  return status if %i[precondition_failed conflict].include? status

  @resource.delete_collection

  response_status status, previous_resource_existed
end