Class: Account

Inherits:
ApplicationRecord show all
Defined in:
app/models/account.rb

Overview

Account’s purpose is to correlate unique identifiers, and to remove our dependency on third party services for a user’s unique identifier.

The account.uuid is intended to become the Vets-API user’s uuid.

Class Method Summary collapse

Methods inherited from ApplicationRecord

descendants_using_encryption, lockbox_options, #timestamp_attributes_for_update_in_model, #valid?

Class Method Details

.lookup_by_user_account_uuid(user_uuid) ⇒ Object

Parameters:

  • user_uuid (String)

    The uuid of current_user in ApplicationController; refers to id for UserAccount table



62
63
64
65
66
67
# File 'app/models/account.rb', line 62

def self.(user_uuid)
   = UserAccount.find_by(id: user_uuid)
  return unless &.icn

  Account.where(icn: .icn).first
end

.lookup_by_user_uuid(user_uuid) ⇒ Object

Parameters:

  • user_uuid (String)

    The uuid of current_user in ApplicationController; may refer to the idme_uuid (preferred) or logingov_uuid



52
53
54
55
56
57
58
# File 'app/models/account.rb', line 52

def self.lookup_by_user_uuid(user_uuid)
  return if user_uuid.blank?

  Account.find_by(idme_uuid: user_uuid) ||
    Account.find_by(logingov_uuid: user_uuid) ||
    (user_uuid)
end