Class: Login::UserAcceptableVerifiedCredentialUpdater
- Inherits:
-
Object
- Object
- Login::UserAcceptableVerifiedCredentialUpdater
- Defined in:
- app/services/login/user_acceptable_verified_credential_updater.rb
Instance Attribute Summary collapse
-
#user_account ⇒ Object
readonly
private
Returns the value of attribute user_account.
Instance Method Summary collapse
- #idme_credential ⇒ Object private
-
#initialize(user_account:) ⇒ UserAcceptableVerifiedCredentialUpdater
constructor
A new instance of UserAcceptableVerifiedCredentialUpdater.
- #logingov_credential ⇒ Object private
- #perform ⇒ Object
- #update_user_acceptable_verified_credential ⇒ Object private
- #user_verifications_array ⇒ Object private
Constructor Details
#initialize(user_account:) ⇒ UserAcceptableVerifiedCredentialUpdater
Returns a new instance of UserAcceptableVerifiedCredentialUpdater.
5 6 7 |
# File 'app/services/login/user_acceptable_verified_credential_updater.rb', line 5 def initialize(user_account:) @user_account = user_account end |
Instance Attribute Details
#user_account ⇒ Object (readonly, private)
Returns the value of attribute user_account.
17 18 19 |
# File 'app/services/login/user_acceptable_verified_credential_updater.rb', line 17 def user_account @user_account end |
Instance Method Details
#idme_credential ⇒ Object (private)
30 31 32 |
# File 'app/services/login/user_acceptable_verified_credential_updater.rb', line 30 def idme_credential @idme_credential ||= user_verifications_array.where.not(idme_uuid: nil).first end |
#logingov_credential ⇒ Object (private)
34 35 36 |
# File 'app/services/login/user_acceptable_verified_credential_updater.rb', line 34 def logingov_credential @logingov_credential ||= user_verifications_array.where.not(logingov_uuid: nil).first end |
#perform ⇒ Object
9 10 11 12 13 |
# File 'app/services/login/user_acceptable_verified_credential_updater.rb', line 9 def perform return unless user_account&.verified? update_user_acceptable_verified_credential end |
#update_user_acceptable_verified_credential ⇒ Object (private)
19 20 21 22 23 24 25 26 27 28 |
# File 'app/services/login/user_acceptable_verified_credential_updater.rb', line 19 def update_user_acceptable_verified_credential user_avc = UserAcceptableVerifiedCredential.find_or_initialize_by(user_account:) user_avc.idme_verified_credential_at ||= Time.zone.now if idme_credential.present? user_avc.acceptable_verified_credential_at ||= Time.zone.now if logingov_credential.present? if user_avc.changed? user_avc.save! Login::UserAcceptableVerifiedCredentialUpdaterLogger.new(user_acceptable_verified_credential: user_avc).perform end end |
#user_verifications_array ⇒ Object (private)
38 39 40 |
# File 'app/services/login/user_acceptable_verified_credential_updater.rb', line 38 def user_verifications_array @user_verifications_array ||= user_account.user_verifications end |