Class: Ridley::ClientObject

Inherits:
ChefObject show all
Defined in:
lib/ridley/chef_objects/client_object.rb

Instance Method Summary collapse

Methods inherited from ChefObject

#<=>, #==, chef_id, #chef_id, chef_json_class, chef_type, #eql?, #hash, #initialize, #inspect, #reload, #save, set_chef_id, set_chef_json_class, set_chef_type, #update

Constructor Details

This class inherits a constructor from Ridley::ChefObject

Instance Method Details

#regenerate_keyBoolean

Regenerates the private key of the instantiated client object. The new private key will be set to the value of the ‘private_key’ accessor of the instantiated client object.

Returns:

  • (Boolean)

    true for success and false for failure



40
41
42
43
# File 'lib/ridley/chef_objects/client_object.rb', line 40

def regenerate_key
  self.private_key = true
  self.save
end

#to_jsonObject

Override to_json to reflect to massage the returned attributes based on the type of connection. Only OHC/OPC requires the json_class attribute is not present.



47
48
49
50
51
52
53
# File 'lib/ridley/chef_objects/client_object.rb', line 47

def to_json
  if resource.connection.hosted?
    to_hash.except(:json_class).to_json
  else
    super
  end
end