Class: WinewooUser::Cellar::RemoveCellarEntry
- Inherits:
-
BaseUseCase
- Object
- BaseUseCase
- WinewooUser::Cellar::RemoveCellarEntry
- Defined in:
- lib/winewoo_core/use_cases/winewoo_user/cellar/remove_cellar_entry.rb
Instance Method Summary collapse
- #call(winewoo_user, entry_id) {|entry ? UseCaseResults.success(entry) : UseCaseResults.not_found| ... } ⇒ Object
-
#initialize(log_params = nil) ⇒ RemoveCellarEntry
constructor
A new instance of RemoveCellarEntry.
Constructor Details
#initialize(log_params = nil) ⇒ RemoveCellarEntry
Returns a new instance of RemoveCellarEntry.
4 5 6 |
# File 'lib/winewoo_core/use_cases/winewoo_user/cellar/remove_cellar_entry.rb', line 4 def initialize(log_params=nil) super(WinewooCore.cellar_repo.new, log_params) end |
Instance Method Details
#call(winewoo_user, entry_id) {|entry ? UseCaseResults.success(entry) : UseCaseResults.not_found| ... } ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/winewoo_core/use_cases/winewoo_user/cellar/remove_cellar_entry.rb', line 9 def call(winewoo_user, entry_id) entry = self.repo.destroy(winewoo_user, entry_id) self.log_repo.create(complete_log_params(entry)) if entry yield entry ? UseCaseResults.success(entry) : UseCaseResults.not_found end |