Class: DocVault::StoreDocument
- Inherits:
-
Object
- Object
- DocVault::StoreDocument
- Defined in:
- lib/doc_vault/store_document.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(document:, id:, bucket:, key:) ⇒ StoreDocument
constructor
A new instance of StoreDocument.
Constructor Details
#initialize(document:, id:, bucket:, key:) ⇒ StoreDocument
Returns a new instance of StoreDocument.
9 10 11 12 13 14 15 |
# File 'lib/doc_vault/store_document.rb', line 9 def initialize(document:, id:, bucket:, key:) @document = document @id = id @bucket = bucket @key = key validate_params end |
Class Method Details
.call(document:, id:, bucket:, key:) ⇒ Object
5 6 7 |
# File 'lib/doc_vault/store_document.rb', line 5 def self.call(document:, id:, bucket:, key:) new(document:, id:, bucket:, key:).call end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 |
# File 'lib/doc_vault/store_document.rb', line 17 def call database = Database.new(@bucket) serialized_doc = DocumentSerializer.serialize(@document) encrypted_doc = Encryption.encrypt(serialized_doc, @key) database.store(@id, encrypted_doc) end |