Class: EVSS::DisabilityCompensationForm::Form8940
- Inherits:
-
Object
- Object
- EVSS::DisabilityCompensationForm::Form8940
- Defined in:
- lib/evss/disability_compensation_form/form8940.rb
Overview
Transforms a client 8940 form submission into the format expected by the EVSS service
Instance Method Summary collapse
- #address(data) ⇒ Object private
- #full_name ⇒ Object private
-
#initialize(user, form_content) ⇒ Form8940
constructor
A new instance of Form8940.
-
#translate ⇒ String
Merges the user data and performs the translation.
Constructor Details
#initialize(user, form_content) ⇒ Form8940
Returns a new instance of Form8940.
11 12 13 14 15 16 |
# File 'lib/evss/disability_compensation_form/form8940.rb', line 11 def initialize(user, form_content) @user = user @phone_email = form_content.dig('form526', 'phoneAndEmail') @mailing_address = form_content.dig('form526', 'mailingAddress') @final_output = form_content.dig('form526', 'form8940') end |
Instance Method Details
#address(data) ⇒ Object (private)
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/evss/disability_compensation_form/form8940.rb', line 45 def address(data) { city: data['city'], country: data['country'], postalCode: data['zipCode'], street: data['addressLine1'], street2: data['addressLine2'], state: data['state'] } end |
#full_name ⇒ Object (private)
37 38 39 40 41 42 43 |
# File 'lib/evss/disability_compensation_form/form8940.rb', line 37 def full_name { first: @user.first_name, middle: @user.middle_name, last: @user.last_name } end |
#translate ⇒ String
Merges the user data and performs the translation
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/evss/disability_compensation_form/form8940.rb', line 22 def translate return nil unless @final_output @final_output['vaFileNumber'] = @user.ssn @final_output['veteranSocialSecurityNumber'] = @user.ssn @final_output['veteranFullName'] = full_name @final_output['veteranDateOfBirth'] = @user.birth_date @final_output['veteranAddress'] = address(@mailing_address) @final_output['email'] = @phone_email['emailAddress'] @final_output['veteranPhone'] = @phone_email['primaryPhone'] @final_output.to_json end |