Class: SavedClaim::DisabilityCompensation

Inherits:
SavedClaim show all
Defined in:
app/models/saved_claim/disability_compensation.rb

Direct Known Subclasses

Form526AllClaim, Form526IncreaseOnly

Defined Under Namespace

Classes: Form526AllClaim, Form526IncreaseOnly

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SavedClaim

add_form_and_validation, #after_create_metrics, #after_destroy_metrics, #attachment_keys, #business_line, #confirmation_number, #email, #form_is_string, #form_matches_schema, #form_must_be_string, #insert_notification, #open_struct_form, #parsed_form, #process_attachments!, #submitted_at, #to_pdf, #update_form, #va_notification?, #validate_form, #validate_schema

Methods inherited from ApplicationRecord

descendants_using_encryption, lockbox_options, #timestamp_attributes_for_update_in_model, #valid?

Instance Attribute Details

#form_hashObject

Returns the value of attribute form_hash.



10
11
12
# File 'app/models/saved_claim/disability_compensation.rb', line 10

def form_hash
  @form_hash
end

Class Method Details

.from_hash(hash) ⇒ Object



16
17
18
19
20
# File 'app/models/saved_claim/disability_compensation.rb', line 16

def self.from_hash(hash)
  saved_claim = new(form: hash['form526'].to_json)
  saved_claim.form_hash = hash
  saved_claim
end

Instance Method Details

#to_submission_data(user) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/models/saved_claim/disability_compensation.rb', line 22

def to_submission_data(user)
  form4142 = EVSS::DisabilityCompensationForm::Form4142.new(user, @form_hash.deep_dup).translate
  form526 = @form_hash.deep_dup
  dis_form = EVSS::DisabilityCompensationForm::DataTranslationAllClaim.new(user, form526, form4142.present?).translate
  claimed_disabilities = dis_form.dig('form526', 'disabilities')
  form526_uploads = form526['form526'].delete('attachments')

  {
    Form526Submission::FORM_526 => dis_form,
    Form526Submission::FORM_526_UPLOADS => form526_uploads,
    Form526Submission::FORM_4142 => form4142,
    Form526Submission::FORM_0781 => EVSS::DisabilityCompensationForm::Form0781.new(user,
                                                                                   @form_hash.deep_dup).translate,
    Form526Submission::FORM_8940 => EVSS::DisabilityCompensationForm::Form8940.new(user,
                                                                                   @form_hash.deep_dup).translate,
    'flashes' => BGS::DisabilityCompensationFormFlashes.new(user, @form_hash.deep_dup, claimed_disabilities).translate
  }.to_json
end