Class: Pension21p527ez::PensionMilitaryInformation
- Inherits:
-
VAProfile::Prefill::MilitaryInformation
- Object
- VAProfile::Prefill::MilitaryInformation
- Pension21p527ez::PensionMilitaryInformation
- Defined in:
- lib/pension_21p527ez/pension_military_information.rb
Overview
extends MilitaryInformation to add additional prefill methods to Pensions military information prefill
Constant Summary collapse
- PREFILL_METHODS =
VAProfile::Prefill::MilitaryInformation::PREFILL_METHODS + %w[ first_uniformed_entry_date last_active_discharge_date service_branches_for_pensions service_number ].freeze
- PENSION_SERVICE_BRANCHES_MAPPING =
Map between service branch names and the fields used for pensions.serviceBranch
{ 'Army' => 'army', 'Navy' => 'navy', 'Air Force' => 'airForce', 'Coast Guard' => 'coastGuard', 'Marine Corps' => 'marineCorps', 'Space Force' => 'spaceForce', 'Public Health Service' => 'usphs', 'National Oceanic & Atmospheric Administration' => 'noaa' }.freeze
Constants inherited from VAProfile::Prefill::MilitaryInformation
VAProfile::Prefill::MilitaryInformation::COMBINED_SERVICE_BRANCHES, VAProfile::Prefill::MilitaryInformation::DISCHARGE_TYPES, VAProfile::Prefill::MilitaryInformation::GULF_WAR_RANGE, VAProfile::Prefill::MilitaryInformation::HCA_SERVICE_BRANCHES, VAProfile::Prefill::MilitaryInformation::NOV_1998, VAProfile::Prefill::MilitaryInformation::SOUTHWEST_ASIA
Instance Attribute Summary
Attributes inherited from VAProfile::Prefill::MilitaryInformation
Instance Method Summary collapse
-
#first_uniformed_entry_date ⇒ String
“YYYY-MM-DD”.
-
#format_service_branches_for_pensions(branches) ⇒ Hash
Filters out any unknown branches.
-
#initialize(user) ⇒ PensionMilitaryInformation
constructor
A new instance of PensionMilitaryInformation.
-
#last_active_discharge_date ⇒ String
“YYYY-MM-DD”.
- #map_service_episodes_to_branches ⇒ Object private
-
#service_branches_for_pensions ⇒ Hash
{ army => true, navy => true, … } in the format required for pensions.serviceBranch.
-
#service_number ⇒ Object
If the veteran began service after 1971, their service number is their SSN We haven’t identified a source for pre-1971 service numbers for prefill.
Methods inherited from VAProfile::Prefill::MilitaryInformation
#currently_active_duty, #currently_active_duty_hash, #deployed_to?, #deployments, #discharge_type, #guard_reserve_service_by_date, #guard_reserve_service_history, #hca_last_service_branch, #last_discharge_date, #last_entry_date, #last_service_branch, #latest_guard_reserve_service_period, #latest_service_episode, #military_service_episodes, #military_service_episodes_by_date, #national_guard?, #post_nov111998_combat, #reserve?, #service_branch_used_in_disability, #service_branches, #service_episodes_by_date, #service_history, #service_periods, #sw_asia_combat, #tours_of_duty
Constructor Details
permalink #initialize(user) ⇒ PensionMilitaryInformation
Returns a new instance of PensionMilitaryInformation.
44 45 46 47 |
# File 'lib/pension_21p527ez/pension_military_information.rb', line 44 def initialize(user) @user = user super end |
Instance Method Details
permalink #first_uniformed_entry_date ⇒ String
Returns “YYYY-MM-DD”.
50 51 52 |
# File 'lib/pension_21p527ez/pension_military_information.rb', line 50 def first_uniformed_entry_date service_history.uniformed_service_initial_entry_date end |
permalink #format_service_branches_for_pensions(branches) ⇒ Hash
Filters out any unknown branches
69 70 71 |
# File 'lib/pension_21p527ez/pension_military_information.rb', line 69 def format_service_branches_for_pensions(branches) branches.uniq.compact_blank.index_with { true } end |
permalink #last_active_discharge_date ⇒ String
Returns “YYYY-MM-DD”.
55 56 57 |
# File 'lib/pension_21p527ez/pension_military_information.rb', line 55 def last_active_discharge_date service_history.release_from_active_duty_date end |
permalink #map_service_episodes_to_branches ⇒ Object (private)
[View source] [View on GitHub]
86 87 88 89 90 91 92 |
# File 'lib/pension_21p527ez/pension_military_information.rb', line 86 def map_service_episodes_to_branches service_history.episodes.map do |episode| branch = episode.branch_of_service branch_value = ClaimsApi::ServiceBranchMapper.new(branch).value PensionMilitaryInformation::PENSION_SERVICE_BRANCHES_MAPPING[branch_value] end end |
permalink #service_branches_for_pensions ⇒ Hash
Returns { army => true, navy => true, … } in the format required for pensions.serviceBranch.
60 61 62 63 64 65 |
# File 'lib/pension_21p527ez/pension_military_information.rb', line 60 def service_branches_for_pensions format_service_branches_for_pensions(map_service_episodes_to_branches) rescue => e Rails.logger.error("Error fetching service branches for Pension prefill: #{e}") {} end |
permalink #service_number ⇒ Object
If the veteran began service after 1971, their service number is their SSN We haven’t identified a source for pre-1971 service numbers for prefill
76 77 78 79 80 81 82 |
# File 'lib/pension_21p527ez/pension_military_information.rb', line 76 def service_number year_of_entry = first_uniformed_entry_date.to_i if first_uniformed_entry_date @user&.ssn_normalized if year_of_entry > 1971 rescue => e Rails.logger.error("Error fetching service number for Pension prefill: #{e}") nil end |