Class: Admins::GlobalWineData::UpdateWineData
- Inherits:
-
BaseUseCase
- Object
- BaseUseCase
- Admins::GlobalWineData::UpdateWineData
- Defined in:
- lib/winewoo_core/use_cases/admins/global_wine_data/update_wine_data.rb
Instance Method Summary collapse
- #call(wine_data_id, data_params) {|global_wine_data ? UseCaseResults.success(global_wine_data) : UseCaseResults.not_found| ... } ⇒ Object
-
#initialize(current_user, log_params = nil) ⇒ UpdateWineData
constructor
A new instance of UpdateWineData.
Constructor Details
#initialize(current_user, log_params = nil) ⇒ UpdateWineData
Returns a new instance of UpdateWineData.
4 5 6 7 |
# File 'lib/winewoo_core/use_cases/admins/global_wine_data/update_wine_data.rb', line 4 def initialize(current_user, log_params=nil) super(WinewooCore.global_wine_data_repo.new, log_params) self.current_caller = current_user end |
Instance Method Details
#call(wine_data_id, data_params) {|global_wine_data ? UseCaseResults.success(global_wine_data) : UseCaseResults.not_found| ... } ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/winewoo_core/use_cases/admins/global_wine_data/update_wine_data.rb', line 10 def call(wine_data_id, data_params) global_wine_data = self.repo.get(wine_data_id) return unless (global_wine_data, &Proc.new) global_wine_data = self.repo.update(wine_data_id, data_params) yield global_wine_data ? UseCaseResults.success(global_wine_data) : UseCaseResults.not_found end |