Class: EVSS::DisabilityCompensationAuthHeaders

Inherits:
BaseHeaders
  • Object
show all
Defined in:
lib/evss/disability_compensation_auth_headers.rb

Instance Method Summary collapse

Methods inherited from BaseHeaders

#initialize

Constructor Details

This class inherits a constructor from EVSS::BaseHeaders

Instance Method Details

#add_headers(auth_headers) ⇒ Object

:nocov:



10
11
12
13
14
# File 'lib/evss/disability_compensation_auth_headers.rb', line 10

def add_headers(auth_headers)
  auth_headers.merge(
    'va_eauth_authorization' => eauth_json
  )
end

#eauth_jsonObject (private)



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/evss/disability_compensation_auth_headers.rb', line 18

def eauth_json
  {
    authorizationResponse: {
      status: 'VETERAN',
      idType: 'SSN',
      id: @user.ssn,
      edi: @user.edipi,
      firstName: @user.first_name,
      lastName: @user.last_name,
      birthDate: Formatters::DateFormatter.format_date(@user.birth_date, :datetime_iso8601),
      gender:
    }
  }.to_json
end

#genderObject (private)



33
34
35
36
37
38
39
40
41
42
# File 'lib/evss/disability_compensation_auth_headers.rb', line 33

def gender
  case @user.gender
  when 'F'
    'FEMALE'
  when 'M'
    'MALE'
  else
    'UNKNOWN'
  end
end