Class: WinewooUser::Account::UpdateWinewooUser

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

Instance Method Summary collapse

Constructor Details

#initialize(log_params = nil) ⇒ UpdateWinewooUser

Returns a new instance of UpdateWinewooUser.



4
5
6
# File 'lib/winewoo_core/use_cases/winewoo_user/account/update_winewoo_user.rb', line 4

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

Instance Method Details

#call(winewoo_user_id, winewoo_user_params) {|winewoo_user ? (winewoo_user.errors.blank? ? UseCaseResults.success(winewoo_user) : UseCaseResults.failure(winewoo_user.errors)) : UseCaseResults.not_found| ... } ⇒ Object

Yields:



9
10
11
12
13
14
15
16
17
18
# File 'lib/winewoo_core/use_cases/winewoo_user/account/update_winewoo_user.rb', line 9

def call(winewoo_user_id, winewoo_user_params)
  winewoo_user = self.repo.update(winewoo_user_id,
                                  winewoo_user_params)

  yield winewoo_user ?
    (winewoo_user.errors.blank? ?
     UseCaseResults.success(winewoo_user) :
     UseCaseResults.failure(winewoo_user.errors)) :
    UseCaseResults.not_found
end