class Calligraphy::Mkcol

Responsible for creating a new collection resource at the location specified by the request.

Public Instance Methods

execute() click to toggle source

Executes the WebDAV request for a particular resource.

# File lib/calligraphy/web_dav_request/mkcol.rb, line 8
def execute
  return :method_not_allowed if @resource.exists?
  return :conflict unless @resource.ancestor_exist?
  return :unsupported_media_type unless @resource.request_body.blank?

  @resource.create_collection
  set_content_location_header

  :created
end

Private Instance Methods

set_content_location_header() click to toggle source
# File lib/calligraphy/web_dav_request/mkcol.rb, line 21
def set_content_location_header
  @response.headers['Content-Location'] = @resource.full_request_path
end