Class: Ridley::UserObject
- Inherits:
-
ChefObject
- Object
- ChefObject
- Ridley::UserObject
- Defined in:
- lib/ridley/chef_objects/user_object.rb
Instance Method Summary collapse
- #authenticate(password) ⇒ Object
-
#regenerate_key ⇒ Boolean
Regenerates the private key of the instantiated user object.
-
#to_json ⇒ Object
Override to_json to reflect to massage the returned attributes based on the type of connection.
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
#authenticate(password) ⇒ Object
43 44 45 |
# File 'lib/ridley/chef_objects/user_object.rb', line 43 def authenticate(password) @resource.authenticate(self.chef_id, password) end |
#regenerate_key ⇒ Boolean
Regenerates the private key of the instantiated user object. The new private key will be set to the value of the ‘private_key’ accessor of the instantiated user object.
38 39 40 41 |
# File 'lib/ridley/chef_objects/user_object.rb', line 38 def regenerate_key self.private_key = true self.save end |
#to_json ⇒ Object
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.
49 50 51 52 53 54 55 |
# File 'lib/ridley/chef_objects/user_object.rb', line 49 def to_json if resource.connection.hosted? to_hash.except(:json_class).to_json else super end end |