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