Class: WinewooUser::Account::AuthenticateWithOauth

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

Instance Method Summary collapse

Constructor Details

#initialize(log_params = nil) ⇒ AuthenticateWithOauth

Returns a new instance of AuthenticateWithOauth.



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

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

Instance Method Details

#call(winewoo_user_params) {|winewoo_user.persisted? && winewoo_user.winewoo_user_devices.any? ? UseCaseResults.success(winewoo_user) : UseCaseResults.failure(winewoo_user.errors)| ... } ⇒ Object

Yields:

  • (winewoo_user.persisted? && winewoo_user.winewoo_user_devices.any? ? UseCaseResults.success(winewoo_user) : UseCaseResults.failure(winewoo_user.errors))


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

def call(winewoo_user_params)
  winewoo_user = self.repo.create(winewoo_user_params)

  yield winewoo_user.persisted? && winewoo_user.winewoo_user_devices.any? ?
    UseCaseResults.success(winewoo_user) :
    UseCaseResults.failure(winewoo_user.errors)
end