summaryrefslogtreecommitdiff
path: root/lib/chef_zero/endpoints/organizations_endpoint.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef_zero/endpoints/organizations_endpoint.rb')
-rw-r--r--lib/chef_zero/endpoints/organizations_endpoint.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/chef_zero/endpoints/organizations_endpoint.rb b/lib/chef_zero/endpoints/organizations_endpoint.rb
index 88816e8..41bf03b 100644
--- a/lib/chef_zero/endpoints/organizations_endpoint.rb
+++ b/lib/chef_zero/endpoints/organizations_endpoint.rb
@@ -17,8 +17,11 @@ module ChefZero
def post(request)
contents = FFI_Yajl::Parser.parse(request.body, :create_additions => false)
name = contents['name']
+ full_name = contents['full_name']
if name.nil?
error(400, "Must specify 'name' in JSON")
+ elsif full_name.nil?
+ error(400, "Must specify 'full_name' in JSON")
elsif exists_data_dir?(request, request.rest_path + [ name ])
error(409, "Organization already exists")
else
@@ -43,8 +46,12 @@ module ChefZero
set_data(request, validator_path, validator)
end
+
json_response(201, {
"uri" => "#{build_uri(request.base_uri, org_path)}",
+ "name" => name,
+ "org_type" => org["org_type"],
+ "full_name" => full_name,
"clientname" => validator_name,
"private_key" => private_key
})