Class: Chef::ChefFS::DataHandler::OrganizationDataHandler

Inherits:
DataHandlerBase show all
Defined in:
lib/chef/chef_fs/data_handler/organization_data_handler.rb

Instance Method Summary collapse

Methods inherited from DataHandlerBase

#chef_class, #chef_object, #default, #from_ruby, #minimize, #normalize_for_post, #normalize_for_put, #normalize_hash, #normalize_run_list, #remove_dot_json, #to_ruby, #to_ruby_keys

Instance Method Details

#normalize(organization, entry) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/chef/chef_fs/data_handler/organization_data_handler.rb', line 7

def normalize(organization, entry)
  result = normalize_hash(organization, {
    'name' => entry.org,
    'full_name' => entry.org,
    'org_type' => 'Business',
    'clientname' => "#{entry.org}-validator",
    'billing_plan' => 'platform-free',
  })
  result
end

#preserve_key?(key) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/chef/chef_fs/data_handler/organization_data_handler.rb', line 18

def preserve_key?(key)
  return key == 'name'
end

#verify_integrity(object, entry, &on_error) ⇒ Object



22
23
24
25
26
# File 'lib/chef/chef_fs/data_handler/organization_data_handler.rb', line 22

def verify_integrity(object, entry, &on_error)
  if entry.org != object['name']
    on_error.call("Name must be '#{entry.org}' (is '#{object['name']}')")
  end
end