summaryrefslogtreecommitdiff
path: root/lib/chef_zero/endpoints/organizations_endpoint.rb
diff options
context:
space:
mode:
authorTyler Ball <tyler-ball@users.noreply.github.com>2015-08-12 12:12:16 -0600
committerTyler Ball <tyler-ball@users.noreply.github.com>2015-08-12 12:12:16 -0600
commit3116c8cc30232103065e4bdf85e043ca20312197 (patch)
treea291011c455b191e98d32ef3db1246d2e99cf926 /lib/chef_zero/endpoints/organizations_endpoint.rb
parent28fe2928469885b0138de4d4270c6eccac8ab482 (diff)
parent67b0d4b3ae451ffa79d4c358e9a0c281822d4743 (diff)
downloadchef-zero-3116c8cc30232103065e4bdf85e043ca20312197.tar.gz
Merge pull request #117 from chef/mp/merge-pedants
CS12 Support
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
})