Class: SafeDb::Put

Inherits:
EditVerse show all
Defined in:
lib/controller/edit/put.rb

Overview

The put use case follows open and it adds secrets into an (encrypted at rest) envelope. Put can be called many times and when done, the lock use case can be called to commit all opened secrets into the configured storage engines.

Calling put before calling open or after calling lock is not allowed and will result in an error.

Put Pre-Conditions

At the point of calling the put use case

  • the safe must be logged in and a chapter and verse opened

  • the key / value pair being put must pass minimum standards

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from EditVerse

#execute

Methods inherited from Controller

#check_post_conditions, #check_pre_conditions, #execute, #flow, #initialize, #open_remote_backend_location, #post_validation, #pre_validation, #read_verse, #set_verse, #update_verse

Constructor Details

This class inherits a constructor from SafeDb::Controller

Instance Attribute Details

#credential_id=(value) ⇒ Object (writeonly)

Sets the attribute credential_id

Parameters:

  • value

    the value to set the attribute credential_id to.



21
22
23
# File 'lib/controller/edit/put.rb', line 21

def credential_id=(value)
  @credential_id = value
end

#credential_value=(value) ⇒ Object (writeonly)

Sets the attribute credential_value

Parameters:

  • value

    the value to set the attribute credential_value to.



21
22
23
# File 'lib/controller/edit/put.rb', line 21

def credential_value=(value)
  @credential_value = value
end

Instance Method Details

#edit_verseObject

Execute the act of validating and then putting the credential key and its value into the chapter and verse location, overwriting if need be.



25
26
27
28
29
# File 'lib/controller/edit/put.rb', line 25

def edit_verse()

  @verse.store( @credential_id, @credential_value )

end