Class: Admins::GlobalWineData::ShowWineData

Inherits:
BaseUseCase
  • Object
show all
Defined in:
lib/winewoo_core/use_cases/admins/global_wine_data/show_wine_data.rb

Instance Method Summary collapse

Constructor Details

#initialize(current_user, log_params = nil) ⇒ ShowWineData

Returns a new instance of ShowWineData.



4
5
6
7
# File 'lib/winewoo_core/use_cases/admins/global_wine_data/show_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) {|global_wine_data ? UseCaseResults.found(global_wine_data) : UseCaseResults.not_found| ... } ⇒ Object

Yields:



10
11
12
13
14
15
16
17
18
# File 'lib/winewoo_core/use_cases/admins/global_wine_data/show_wine_data.rb', line 10

def call(wine_data_id)
  global_wine_data = self.repo.get(wine_data_id)

  return unless authorize_wine_data_show(global_wine_data, &Proc.new)

  yield global_wine_data ?
    UseCaseResults.found(global_wine_data) :
    UseCaseResults.not_found
end