Class: Login::UserAcceptableVerifiedCredentialUpdater

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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 = 
end

Instance Attribute Details

#user_accountObject (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
end

Instance Method Details

#idme_credentialObject (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_credentialObject (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

#performObject



9
10
11
12
13
# File 'app/services/login/user_acceptable_verified_credential_updater.rb', line 9

def perform
  return unless &.verified?

  update_user_acceptable_verified_credential
end

#update_user_acceptable_verified_credentialObject (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_arrayObject (private)



38
39
40
# File 'app/services/login/user_acceptable_verified_credential_updater.rb', line 38

def user_verifications_array
  @user_verifications_array ||= .user_verifications
end