Module: RedisForm

Extended by:
ActiveSupport::Concern
Included in:
DependentsApplication, GIBillFeedback
Defined in:
app/models/concerns/redis_form.rb

Instance Method Summary collapse

Instance Method Details

#form_matches_schemaObject (private)



51
52
53
54
55
56
57
# File 'app/models/concerns/redis_form.rb', line 51

def form_matches_schema
  if form.present?
    JSON::Validator.fully_validate(VetsJsonSchema::SCHEMAS[self.class::FORM_ID], parsed_form).each do |v|
      errors.add(:form, v.to_s)
    end
  end
end

#parsed_formObject



30
31
32
# File 'app/models/concerns/redis_form.rb', line 30

def parsed_form
  @parsed_form ||= JSON.parse(form)
end

#parsed_responseObject



34
35
36
37
38
# File 'app/models/concerns/redis_form.rb', line 34

def parsed_response
  return if response.blank?

  @parsed_response ||= JSON.parse(response)
end

#saveObject



40
41
42
43
44
45
46
47
# File 'app/models/concerns/redis_form.rb', line 40

def save
  originally_persisted = @persisted
  saved = super

  create_submission_job if saved && !originally_persisted

  saved
end