Class: V0::HealthCareApplicationsController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- V0::HealthCareApplicationsController
- Includes:
- IgnoreNotFound
- Defined in:
- app/controllers/v0/health_care_applications_controller.rb
Constant Summary collapse
- FORM_ID =
'1010ez'
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
- #enrollment_status ⇒ Object
- #healthcheck ⇒ Object
- #rating_info ⇒ Object
- #show ⇒ Object
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
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/v0/health_care_applications_controller.rb', line 31 def create health_care_application.async_compatible = params[:async_all] health_care_application.google_analytics_client_id = params[:ga_client_id] health_care_application.user = current_user begin result = health_care_application.process! rescue HCA::SOAPParser::ValidationError raise Common::Exceptions::BackendServiceException.new('HCA422', status: 422) end clear_saved_form(FORM_ID) render(json: result) end |
#download_pdf ⇒ Object
76 77 78 79 80 81 82 |
# File 'app/controllers/v0/health_care_applications_controller.rb', line 76 def download_pdf source_file_path = PdfFill::Filler.fill_form(health_care_application, SecureRandom.uuid, sign: false) file_contents = File.read(source_file_path) File.delete(source_file_path) send_data file_contents, filename: file_name_for_pdf, type: 'application/pdf', disposition: 'attachment' end |
#enrollment_status ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/controllers/v0/health_care_applications_controller.rb', line 51 def enrollment_status loa3 = current_user&.loa3? icn = if loa3 current_user.icn else Raven.extra_context( user_loa: current_user&.loa ) HealthCareApplication.user_icn( HealthCareApplication.user_attributes(params[:userAttributes]) ) end raise Common::Exceptions::RecordNotFound, nil if icn.blank? render(json: HealthCareApplication.enrollment_status(icn, loa3)) end |
#healthcheck ⇒ Object
72 73 74 |
# File 'app/controllers/v0/health_care_applications_controller.rb', line 72 def healthcheck render(json: HCA::Service.new.health_check) end |
#rating_info ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/v0/health_care_applications_controller.rb', line 20 def service = BGS::Service.new(current_user) = service.[:disability_rating_record][:service_connected_combined_degree] render( json: { user_percent_of_disability: }, serializer: HCARatingInfoSerializer ) end |
#show ⇒ Object
47 48 49 |
# File 'app/controllers/v0/health_care_applications_controller.rb', line 47 def show render(json: HealthCareApplication.find(params[:id])) end |