Class: WinewooUser::Comments::ShowComment

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

Instance Method Summary collapse

Constructor Details

#initialize(log_params = nil) ⇒ ShowComment

Returns a new instance of ShowComment.



4
5
6
# File 'lib/winewoo_core/use_cases/winewoo_user/comments/show_comment.rb', line 4

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

Instance Method Details

#call(wine_id, vintage_id, comment_id) {|comment ? UseCaseResults.success(comment) : UseCaseResults.not_found| ... } ⇒ Object

Yields:



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

def call(wine_id, vintage_id, comment_id)
  comment = self.repo.show(wine_id, vintage_id, comment_id)

  yield comment ?
    UseCaseResults.success(comment) :
    UseCaseResults.not_found
end