Class: WinewooUser::Favorites::GetFavorites

Inherits:
BaseUseCase
  • Object
show all
Defined in:
lib/winewoo_core/use_cases/winewoo_user/favorites/get_favorites.rb

Instance Method Summary collapse

Constructor Details

#initialize(log_params = nil) ⇒ GetFavorites

Returns a new instance of GetFavorites.



4
5
6
# File 'lib/winewoo_core/use_cases/winewoo_user/favorites/get_favorites.rb', line 4

def initialize(log_params=nil)
  super(WinewooCore.favorites_repo.new, log_params)
end

Instance Method Details

#call(winewoo_user, filters) {|favorites ? UseCaseResults.found(favorites) : UseCaseResults.failure| ... } ⇒ Object

Yields:



9
10
11
12
13
14
15
# File 'lib/winewoo_core/use_cases/winewoo_user/favorites/get_favorites.rb', line 9

def call(winewoo_user, filters)
  favorites = self.repo.find(winewoo_user, filters)

  yield favorites ?
    UseCaseResults.found(favorites) :
    UseCaseResults.failure
end