Class: WinewooUser::Comments::UpdateComment
- Inherits:
-
BaseUseCase
- Object
- BaseUseCase
- WinewooUser::Comments::UpdateComment
- Defined in:
- lib/winewoo_core/use_cases/winewoo_user/comments/update_comment.rb
Instance Method Summary collapse
- #call(wine_id, vintage_id, comment_id, comment_params) {|comment ? (comment.errors.blank? ? UseCaseResults.success(comment) : UseCaseResults.failure(comment.errors)) : UseCaseResults.not_found| ... } ⇒ Object
-
#initialize(log_params = nil) ⇒ UpdateComment
constructor
A new instance of UpdateComment.
Constructor Details
#initialize(log_params = nil) ⇒ UpdateComment
Returns a new instance of UpdateComment.
4 5 6 |
# File 'lib/winewoo_core/use_cases/winewoo_user/comments/update_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_params) {|comment ? (comment.errors.blank? ? UseCaseResults.success(comment) : UseCaseResults.failure(comment.errors)) : UseCaseResults.not_found| ... } ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/winewoo_core/use_cases/winewoo_user/comments/update_comment.rb', line 9 def call(wine_id, vintage_id, comment_id, comment_params) comment = self.repo.update(wine_id, vintage_id, comment_id, comment_params) yield comment ? (comment.errors.blank? ? UseCaseResults.success(comment) : UseCaseResults.failure(comment.errors)) : UseCaseResults.not_found end |