Module: Cuprum::Collections::Commands::AbstractFindOne
- Includes:
- ParameterValidation
- Included in:
- Basic::Commands::FindOne
- Defined in:
- lib/cuprum/collections/commands/abstract_find_one.rb
Overview
Abstract implementation of the FindOne command.
Instance Method Summary collapse
-
#call(primary_key:, envelope: false) ⇒ Cuprum::Result<Hash{String, Object}>
Queries the collection for the item with the given primary key.
Instance Method Details
#call(primary_key:, envelope: false) ⇒ Cuprum::Result<Hash{String, Object}>
Queries the collection for the item with the given primary key.
The command will find and return the entity with the given primary key. If the entity is not found, the command will fail and return a NotFound error.
When the :envelope option is true, the command wraps the item in a Hash, using the singular name of the collection as the key.
28 |
# File 'lib/cuprum/collections/commands/abstract_find_one.rb', line 28 validate :envelope, :boolean, optional: true |