Class: Wines::RemoveAward
- Inherits:
-
BaseUseCase
- Object
- BaseUseCase
- Wines::RemoveAward
- Defined in:
- lib/winewoo_core/use_cases/wines/remove_award.rb
Instance Method Summary collapse
- #call(wine_id, vintage_id) {|award ? UseCaseResults.success(award) : UseCaseResults.not_found| ... } ⇒ Object
-
#initialize(current_user) ⇒ RemoveAward
constructor
A new instance of RemoveAward.
Constructor Details
#initialize(current_user) ⇒ RemoveAward
Returns a new instance of RemoveAward.
4 5 6 7 |
# File 'lib/winewoo_core/use_cases/wines/remove_award.rb', line 4 def initialize(current_user) super(WinewooCore.award_repo.new) self.current_caller = current_user end |
Instance Method Details
#call(wine_id, vintage_id) {|award ? UseCaseResults.success(award) : UseCaseResults.not_found| ... } ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/winewoo_core/use_cases/wines/remove_award.rb', line 10 def call(wine_id, vintage_id) wine = WinewooCore.wines_repo.new.get(wine_id) return unless (wine, &Proc.new) award = self.repo.destroy(wine_id, vintage_id) yield award ? UseCaseResults.success(award) : UseCaseResults.not_found end |