Class: WinewooUser::Devices::UpdateWinewooUserDevice

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

Instance Method Summary collapse

Constructor Details

#initialize(log_params = nil) ⇒ UpdateWinewooUserDevice

Returns a new instance of UpdateWinewooUserDevice.



4
5
6
# File 'lib/winewoo_core/use_cases/winewoo_user/devices/update_winewoo_user_device.rb', line 4

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

Instance Method Details

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

Yields:



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

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

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