def delete(request)
begin
doomed_cookbook_json = get_data(request)
identified_cookbook_data = normalize(request, parse_json(doomed_cookbook_json))
delete_data(request)
hoover_unused_checksums(get_checksums(doomed_cookbook_json), request)
cookbook_path = request.rest_path[0..3]
if exists_data_dir?(request, cookbook_path) && list_data(request, cookbook_path).size == 0
delete_data_dir(request, cookbook_path)
end
json_response(200, identified_cookbook_data)
rescue RestErrorResponse => ex
if ex.response_code == 404
error(404, "not_found")
else
raise
end
end
end