Class: ChefZero::Endpoints::DataBagItemEndpoint

Inherits:
RestObjectEndpoint show all
Defined in:
lib/chef_zero/endpoints/data_bag_item_endpoint.rb

Overview

/data/NAME/NAME

Instance Attribute Summary

Attributes inherited from RestObjectEndpoint

#identity_keys

Attributes inherited from RestBase

#server

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RestObjectEndpoint

#delete, #get, #patch_request_body, #put

Methods inherited from RestBase

#accepts?, #already_json_response, build_uri, #build_uri, #call, #create_data, #create_data_dir, #data_store, #delete_data, #delete_data_dir, #error, #exists_data?, #exists_data_dir?, #get_data, #json_only, #json_response, #list_data, #set_data, #text_response

Constructor Details

#initialize(server) ⇒ DataBagItemEndpoint

Returns a new instance of DataBagItemEndpoint


10
11
12
# File 'lib/chef_zero/endpoints/data_bag_item_endpoint.rb', line 10

def initialize(server)
  super(server, 'id')
end

Class Method Details

.populate_defaults(request, response_json, data_bag, data_bag_item) ⇒ Object


18
19
20
21
22
# File 'lib/chef_zero/endpoints/data_bag_item_endpoint.rb', line 18

def self.populate_defaults(request, response_json, data_bag, data_bag_item)
  response = FFI_Yajl::Parser.parse(response_json, :create_additions => false)
  response = ChefData::DataNormalizer.normalize_data_bag_item(response, data_bag, data_bag_item, request.method)
  FFI_Yajl::Encoder.encode(response, :pretty => true)
end

Instance Method Details

#populate_defaults(request, response_json) ⇒ Object


14
15
16
# File 'lib/chef_zero/endpoints/data_bag_item_endpoint.rb', line 14

def populate_defaults(request, response_json)
  DataBagItemEndpoint::populate_defaults(request, response_json, request.rest_path[3], request.rest_path[4])
end