Class: Login::UserCredentialEmailUpdater

Inherits:
Object
  • Object
show all
Defined in:
app/services/login/user_credential_email_updater.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(credential_email:, user_verification:) ⇒ UserCredentialEmailUpdater

Returns a new instance of UserCredentialEmailUpdater.



5
6
7
8
# File 'app/services/login/user_credential_email_updater.rb', line 5

def initialize(credential_email:, user_verification:)
  @credential_email = credential_email
  @user_verification = user_verification
end

Instance Attribute Details

#credential_emailObject (readonly, private)

Returns the value of attribute credential_email.



18
19
20
# File 'app/services/login/user_credential_email_updater.rb', line 18

def credential_email
  @credential_email
end

#user_verificationObject (readonly, private)

Returns the value of attribute user_verification.



18
19
20
# File 'app/services/login/user_credential_email_updater.rb', line 18

def user_verification
  @user_verification
end

Instance Method Details

#performObject



10
11
12
13
14
# File 'app/services/login/user_credential_email_updater.rb', line 10

def perform
  return unless user_verification && credential_email

  update_user_credential_email
end

#update_user_credential_emailObject (private)



20
21
22
23
24
# File 'app/services/login/user_credential_email_updater.rb', line 20

def update_user_credential_email
  user_credential_email = UserCredentialEmail.find_or_initialize_by(user_verification:)
  user_credential_email.credential_email = credential_email
  user_credential_email.save!
end