Class: WinewooUser::Account::CreateWinewooUserForInterpro

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

Instance Method Summary collapse

Constructor Details

#initialize(log_params = nil) ⇒ CreateWinewooUserForInterpro

Returns a new instance of CreateWinewooUserForInterpro.



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

def initialize(log_params=nil)
  super(WinewooCore::Repositories::Mongo::InterproWinewooUsersMongoRepo.new, log_params)
end

Instance Method Details

#call(current_interpro, winewoo_user_params) {|(wuser.valid? && device.valid? ) ? UseCaseResults.success(wuser) : UseCaseResults.failure(wuser.errors.to_a.concat(device.errors.to_a))| ... } ⇒ Object

Yields:



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

def call(current_interpro, winewoo_user_params)
  wuser, device = self.repo.create(current_interpro, winewoo_user_params)

  yield (wuser.valid? && device.valid? ) ?
    UseCaseResults.success(wuser) :
    UseCaseResults.failure(wuser.errors.to_a.concat(device.errors.to_a))
end