Class: V0::CaregiversAssistanceClaimsController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- V0::CaregiversAssistanceClaimsController
- Defined in:
- app/controllers/v0/caregivers_assistance_claims_controller.rb
Overview
Application for the Program of Comprehensive Assistance for Family Caregivers (Form 10-10CG)
Constant Summary collapse
- AUDITOR =
::Form1010cg::Auditor.new
Constants inherited from ApplicationController
ApplicationController::VERSION_STATUS
Constants included from SignIn::Authentication
SignIn::Authentication::BEARER_PATTERN
Constants included from ExceptionHandling
ExceptionHandling::SKIP_SENTRY_EXCEPTION_TYPES
Instance Method Summary collapse
- #create ⇒ Object
-
#download_pdf ⇒ Object
If we were unable to submit the user’s claim digitally, we allow them to the download the 10-10CG PDF, pre-filled with their data, for them to mail in.
Methods inherited from ApplicationController
#clear_saved_form, #cors_preflight, #routing_error
Methods included from Traceable
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger
Methods included from SignIn::Authentication
#authenticate, #authenticate_service_account, #load_user
Methods included from Headers
#block_unknown_hosts, #set_app_info_headers
Methods included from AuthenticationAndSSOConcerns
#authenticate, #clear_session, #extend_session!, #load_user, #log_sso_info, #render_unauthorized, #reset_session, #set_api_cookie!, #set_session_expiration_header, #sso_logging_info, #validate_inbound_login_params, #validate_session
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/v0/caregivers_assistance_claims_controller.rb', line 18 def create if @claim.valid? Raven.(claim_guid: @claim.guid) auditor.record_caregivers(@claim) ::Form1010cg::Service.new(@claim).assert_veteran_status @claim.save! ::Form1010cg::SubmissionJob.perform_async(@claim.id) render(json: @claim, serializer: ::Form1010cg::ClaimSerializer) else PersonalInformationLog.create!(data: { form: @claim.parsed_form }, error_class: '1010CGValidationError') auditor.record(:submission_failure_client_data, claim_guid: @claim.guid, errors: @claim.errors.) raise(Common::Exceptions::ValidationErrors, @claim) end end |
#download_pdf ⇒ Object
If we were unable to submit the user’s claim digitally, we allow them to the download the 10-10CG PDF, pre-filled with their data, for them to mail in.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/v0/caregivers_assistance_claims_controller.rb', line 37 def download_pdf # Brakeman will raise a warning if we use a claim's method or attribute in the source file name. # Use an arbitrary uuid for the source file name and don't use the return value of claim#to_pdf # as the source_file_path (to prevent changes in the the filename creating a vunerability in the future). source_file_path = PdfFill::Filler.fill_form(@claim, SecureRandom.uuid, sign: false) client_file_name = file_name_for_pdf(@claim.veteran_data) file_contents = File.read(source_file_path) # rubocop:disable Lint/NonAtomicFileOperation File.delete(source_file_path) if File.exist?(source_file_path) # rubocop:enable Lint/NonAtomicFileOperation auditor.record(:pdf_download) send_data file_contents, filename: client_file_name, type: 'application/pdf', disposition: 'attachment' end |