Class: V0::HealthCareApplicationsController
Constant Summary
collapse
- FORM_ID =
'1010ez'
ApplicationController::VERSION_STATUS
SignIn::Authentication::BEARER_PATTERN
ExceptionHandling::SKIP_SENTRY_EXCEPTION_TYPES
Instance Attribute Summary
#current_user
Instance Method Summary
collapse
#clear_saved_form, #cors_preflight, #pagination_params, #render_job_id, #routing_error, #set_csrf_header
Methods included from Traceable
#set_trace_tags
#set_tags_and_extra_context, #tags_context, #user_context
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata
#append_info_to_payload
#access_token, #access_token_authenticate, #authenticate, #authenticate_access_token, #bearer_token, #cookie_access_token, #handle_authenticate_error, #load_user, #load_user_object, #scrub_bearer_token, #validate_request_ip
Methods included from Headers
#set_app_info_headers
#render_errors, #report_mapped_exception, #report_original_exception, #skip_sentry_exception?
#authenticate, #clear_session, #extend_session!, #load_user, #log_sso_info, #render_unauthorized, #reset_session, #set_api_cookie!, #set_current_user, #set_session_expiration_header, #set_session_object, #sign_in_service_exp_time, #sign_in_service_session, #sso_cookie_content, #sso_logging_info, #validate_inbound_login_params, #validate_session
#authenticate, #validate_audience!
Instance Method Details
#active_facilities(lighthouse_facilities) ⇒ Object
88
89
90
91
|
# File 'app/controllers/v0/health_care_applications_controller.rb', line 88
def active_facilities(lighthouse_facilities)
active_ids = active_ves_facility_ids
lighthouse_facilities.select { |facility| active_ids.include?(facility.unique_id) }
end
|
#active_ves_facility_ids ⇒ Object
93
94
95
96
97
98
99
100
101
102
|
# File 'app/controllers/v0/health_care_applications_controller.rb', line 93
def active_ves_facility_ids
ids = cached_ves_facility_ids
return ids if ids.any?
return ids if Flipper.enabled?(:hca_retrieve_facilities_without_repopulating)
HCA::StdInstitutionImportJob.new.perform
cached_ves_facility_ids
end
|
#cached_ves_facility_ids ⇒ Object
104
105
106
|
# File 'app/controllers/v0/health_care_applications_controller.rb', line 104
def cached_ves_facility_ids
StdInstitutionFacility.active.pluck(:station_number).compact
end
|
#create ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'app/controllers/v0/health_care_applications_controller.rb', line 35
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)
if result[:id]
render json: HealthCareApplicationSerializer.new(result)
else
render json: result
end
end
|
#enrollment_status ⇒ Object
#facilities ⇒ Object
80
81
82
83
84
|
# File 'app/controllers/v0/health_care_applications_controller.rb', line 80
def facilities
lighthouse_facilities = lighthouse_facilities_service.get_facilities(lighthouse_facilities_params)
render(json: active_facilities(lighthouse_facilities))
end
|
#health_care_application ⇒ Object
108
109
110
|
# File 'app/controllers/v0/health_care_applications_controller.rb', line 108
def health_care_application
@health_care_application ||= HealthCareApplication.new(params.permit(:form))
end
|
#healthcheck ⇒ Object
76
77
78
|
# File 'app/controllers/v0/health_care_applications_controller.rb', line 76
def healthcheck
render(json: HCA::Service.new.health_check)
end
|
#lighthouse_facilities_params ⇒ Object
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
# File 'app/controllers/v0/health_care_applications_controller.rb', line 116
def lighthouse_facilities_params
params.except(:format).permit(
:zip,
:state,
:lat,
:long,
:radius,
:bbox,
:visn,
:type,
:services,
:mobile,
:page,
:per_page,
facilityIds: []
)
end
|
#lighthouse_facilities_service ⇒ Object
112
113
114
|
# File 'app/controllers/v0/health_care_applications_controller.rb', line 112
def lighthouse_facilities_service
@lighthouse_facilities_service ||= Lighthouse::Facilities::V1::Client.new
end
|
#rating_info ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/controllers/v0/health_care_applications_controller.rb', line 21
def rating_info
if Flipper.enabled?(:hca_disable_bgs_service)
render json: HCARatingInfoSerializer.new({ user_percent_of_disability: 0 })
return
end
service = BGS::Service.new(current_user)
disability_rating = service.find_rating_data[:disability_rating_record][:service_connected_combined_degree]
hca_rating_info = { user_percent_of_disability: disability_rating }
render json: HCARatingInfoSerializer.new(hca_rating_info)
end
|
#record_submission_attempt ⇒ Object
134
135
136
137
138
139
|
# File 'app/controllers/v0/health_care_applications_controller.rb', line 134
def record_submission_attempt
StatsD.increment("#{HCA::Service::STATSD_KEY_PREFIX}.submission_attempt")
if health_care_application.short_form?
StatsD.increment("#{HCA::Service::STATSD_KEY_PREFIX}.submission_attempt_short_form")
end
end
|
#skip_sentry_exception_types ⇒ Object