summaryrefslogtreecommitdiff
path: root/lib/chef_zero/endpoints/sandbox_endpoint.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef_zero/endpoints/sandbox_endpoint.rb')
-rw-r--r--lib/chef_zero/endpoints/sandbox_endpoint.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/chef_zero/endpoints/sandbox_endpoint.rb b/lib/chef_zero/endpoints/sandbox_endpoint.rb
new file mode 100644
index 0000000..09cb180
--- /dev/null
+++ b/lib/chef_zero/endpoints/sandbox_endpoint.rb
@@ -0,0 +1,22 @@
+require 'chef_zero/rest_base'
+
+module ChefZero
+ module Endpoints
+ # /sandboxes/ID
+ class SandboxEndpoint < RestBase
+ def put(request)
+ existing_sandbox = get_data(request, request.rest_path)
+ data['sandboxes'].delete(request.rest_path[1])
+ time_str = existing_sandbox[:create_time].strftime('%Y-%m-%dT%H:%M:%S%z')
+ time_str = "#{time_str[0..21]}:#{time_str[22..23]}"
+ json_response(200, {
+ :guid => request.rest_path[1],
+ :name => request.rest_path[1],
+ :checksums => existing_sandbox[:checksums],
+ :create_time => time_str,
+ :is_completed => true
+ })
+ end
+ end
+ end
+end