Class: BGSDependents::MarriageHistory

Inherits:
Base show all
Defined in:
app/models/bgs_dependents/marriage_history.rb

Constant Summary

Constants inherited from Base

Base::MILITARY_POST_OFFICE_TYPE_CODES

Instance Attribute Summary

Attributes inherited from Common::Base

#errors_hash, #metadata

Instance Method Summary collapse

Methods inherited from Base

#adjust_address_lines_for!, #adjust_country_name_for!, #create_address_params, #create_person_params, #dependent_address, #format_date, #formatted_boolean, #generate_address, #relationship_type, #serialize_dependent_result

Methods inherited from Common::Base

#changed, #changed?, #changes, default_sort, filterable_attributes, max_per_page, per_page, sortable_attributes

Constructor Details

#initialize(former_spouse) ⇒ MarriageHistory

Returns a new instance of MarriageHistory.



5
6
7
# File 'app/models/bgs_dependents/marriage_history.rb', line 5

def initialize(former_spouse)
  @former_spouse = former_spouse
end

Instance Method Details

#format_infoObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/models/bgs_dependents/marriage_history.rb', line 9

def format_info
  {
    start_date: @former_spouse['start_date'],
    end_date: @former_spouse['end_date'],
    marriage_country: @former_spouse.dig('start_location', 'country'),
    marriage_state: @former_spouse.dig('start_location', 'state'),
    marriage_city: @former_spouse.dig('start_location', 'city'),
    divorce_country: @former_spouse.dig('end_location', 'country'),
    divorce_state: @former_spouse.dig('end_location', 'state'),
    divorce_city: @former_spouse.dig('end_location', 'city'),
    marriage_termination_type_code: @former_spouse['reason_marriage_ended']
  }.merge(@former_spouse['full_name']).with_indifferent_access
end