diff options
Diffstat (limited to 'lib/chef_zero/endpoints/data_bag_endpoint.rb')
-rw-r--r-- | lib/chef_zero/endpoints/data_bag_endpoint.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/chef_zero/endpoints/data_bag_endpoint.rb b/lib/chef_zero/endpoints/data_bag_endpoint.rb index f7a6142..2f754cf 100644 --- a/lib/chef_zero/endpoints/data_bag_endpoint.rb +++ b/lib/chef_zero/endpoints/data_bag_endpoint.rb @@ -1,14 +1,14 @@ -require 'ffi_yajl' -require 'chef_zero/endpoints/rest_list_endpoint' -require 'chef_zero/endpoints/data_bag_item_endpoint' -require 'chef_zero/rest_error_response' +require "ffi_yajl" +require "chef_zero/endpoints/rest_list_endpoint" +require "chef_zero/endpoints/data_bag_item_endpoint" +require "chef_zero/rest_error_response" module ChefZero module Endpoints # /data/NAME class DataBagEndpoint < RestListEndpoint def initialize(server) - super(server, 'id') + super(server, "id") end def post(request) @@ -16,7 +16,7 @@ module ChefZero key = identity_keys.map { |k| json[k] }.select { |v| v }.first response = super(request) if response[0] == 201 - already_json_response(201, DataBagItemEndpoint::populate_defaults(request, request.body, request.rest_path[3], key)) + already_json_response(201, DataBagItemEndpoint.populate_defaults(request, request.body, request.rest_path[3], key)) else response end @@ -24,10 +24,10 @@ module ChefZero def get_key(contents) data_bag_item = FFI_Yajl::Parser.parse(contents, :create_additions => false) - if data_bag_item['json_class'] == 'Chef::DataBagItem' && data_bag_item['raw_data'] - data_bag_item['raw_data']['id'] + if data_bag_item["json_class"] == "Chef::DataBagItem" && data_bag_item["raw_data"] + data_bag_item["raw_data"]["id"] else - data_bag_item['id'] + data_bag_item["id"] end end @@ -35,9 +35,9 @@ module ChefZero key = request.rest_path[3] delete_data_dir(request, request.rest_path, :recursive) json_response(200, { - 'chef_type' => 'data_bag', - 'json_class' => 'Chef::DataBag', - 'name' => key + "chef_type" => "data_bag", + "json_class" => "Chef::DataBag", + "name" => key, }) end end |