Class: WinewooCore::Services::Finders::Comments::CommentsFinderBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/winewoo_core/services/finders/comments/comments_finder_builder.rb

Class Method Summary collapse

Class Method Details

.build(current_winewoo_user, wine_id, vintage_id, winewoo_user_id, filters) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/winewoo_core/services/finders/comments/comments_finder_builder.rb', line 4

def self.build(current_winewoo_user, wine_id, vintage_id, winewoo_user_id, filters)

  if wine_id
    if vintage_id
      return VintageCommentsFinder.new(wine_id, vintage_id, filters)
    else
      return WineCommentsFinder.new(wine_id, filters)
    end
  end

  if winewoo_user_id
    return WinewooUserCommentsFinder.new(winewoo_user_id, filters)
  end

  unless (wine_id || vintage_id || winewoo_user_id)
    return CurrentWinewooUserCommentsFinder.new(current_winewoo_user, filters)
  end
end