Class: Calligraphy::Copy

Inherits:
WebDavRequest show all
Defined in:
lib/calligraphy/web_dav_request/copy.rb

Overview

Responsible for creating a duplicate of the source resource identified by the request to the destination resource identified by the URI in the Destination header.

Direct Known Subclasses

Move

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.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/calligraphy/web_dav_request/copy.rb', line 9

def execute
  options = copy_move_options
  copy_options = @resource.copy_options options

  unless copy_options[:can_copy]
    return :precondition_failed if copy_options[:ancestor_exist]
    return :conflict
  end

  return :locked if copy_options[:locked]

  overwritten = @resource.copy options
  overwritten ? :no_content : :created
end