Class: V0::Form1095BsController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- V0::Form1095BsController
- Defined in:
- app/controllers/v0/form1095_bs_controller.rb
Constant Summary
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 Attribute Summary
Attributes inherited from ApplicationController
Instance Method Summary collapse
- #available_forms ⇒ Object
- #download_params ⇒ Object private
- #download_pdf ⇒ Object
- #download_txt ⇒ Object
- #set_available_forms ⇒ Object private
- #set_form ⇒ Object private
Methods inherited from ApplicationController
#clear_saved_form, #cors_preflight, #pagination_params, #render_job_id, #routing_error, #set_csrf_header
Methods included from Traceable
Methods included from SentryControllerLogging
#set_tags_and_extra_context, #tags_context, #user_context
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata
Methods included from Instrumentation
Methods included from SignIn::Authentication
#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
Methods included from ExceptionHandling
#render_errors, #report_mapped_exception, #report_original_exception, #skip_sentry_exception?, #skip_sentry_exception_types
Methods included from AuthenticationAndSSOConcerns
#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
Methods included from SignIn::AudienceValidator
#authenticate, #validate_audience!
Instance Method Details
#available_forms ⇒ Object
10 11 12 |
# File 'app/controllers/v0/form1095_bs_controller.rb', line 10 def available_forms render json: { available_forms: @available_forms } end |
#download_params ⇒ Object (private)
40 41 42 |
# File 'app/controllers/v0/form1095_bs_controller.rb', line 40 def download_params params.permit(:tax_year) end |
#download_pdf ⇒ Object
14 15 16 17 |
# File 'app/controllers/v0/form1095_bs_controller.rb', line 14 def download_pdf file_name = "1095B_#{download_params[:tax_year]}.pdf" send_data @form.pdf_file, filename: file_name, type: 'application/pdf', disposition: 'inline' end |
#download_txt ⇒ Object
19 20 21 22 |
# File 'app/controllers/v0/form1095_bs_controller.rb', line 19 def download_txt file_name = "1095B_#{download_params[:tax_year]}.txt" send_data @form.txt_file, filename: file_name, type: 'text/plain', disposition: 'inline' end |
#set_available_forms ⇒ Object (private)
35 36 37 38 |
# File 'app/controllers/v0/form1095_bs_controller.rb', line 35 def set_available_forms forms = Form1095B.available_forms(@current_user[:icn]) @available_forms = forms.map { |form| { year: form[0], last_updated: form[1] } } end |
#set_form ⇒ Object (private)
26 27 28 29 30 31 32 33 |
# File 'app/controllers/v0/form1095_bs_controller.rb', line 26 def set_form @form = Form1095B.find_by(veteran_icn: @current_user[:icn], tax_year: download_params[:tax_year]) if @form.blank? Rails.logger.error("Form 1095-B for #{download_params[:tax_year]} not found", user_uuid: @current_user&.uuid) raise Common::Exceptions::RecordNotFound, download_params[:tax_year] end end |