Class: V0::DependentsApplicationsController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- V0::DependentsApplicationsController
- Defined in:
- app/controllers/v0/dependents_applications_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
- #create ⇒ Object
- #dependency_verification_service ⇒ Object private
- #dependent_params ⇒ Object private
- #dependent_service ⇒ Object private
- #disability_rating ⇒ Object
- #show ⇒ Object
- #stats_key ⇒ 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
#create ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/v0/dependents_applications_controller.rb', line 7 def create claim = SavedClaim::DependencyClaim.new(form: dependent_params.to_json) unless claim.save StatsD.increment("#{stats_key}.failure") Sentry.(team: 'vfs-ebenefits') # tag sentry logs with team name raise Common::Exceptions::ValidationErrors, claim end claim. dependent_service.submit_686c_form(claim) Rails.logger.info "ClaimID=#{claim.confirmation_number} Form=#{claim.class::FORM}" # clear_saved_form(claim.form_id) # We do not want to destroy the InProgressForm for this submission render json: SavedClaimSerializer.new(claim) end |
#dependency_verification_service ⇒ Object (private)
63 64 65 |
# File 'app/controllers/v0/dependents_applications_controller.rb', line 63 def dependency_verification_service @dependency_verification_service ||= BGS::DependencyVerificationService.new(current_user) end |
#dependent_params ⇒ Object (private)
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/v0/dependents_applications_controller.rb', line 41 def dependent_params params.permit( :add_spouse, :veteran_was_married_before, :add_child, :report674, :report_divorce, :spouse_was_married_before, :report_stepchild_not_in_household, :report_death, :report_marriage_of_child_under18, :report_child18_or_older_is_not_attending_school, 'view:selectable686_options': {}, dependents_application: {}, supporting_documents: [] ) end |
#dependent_service ⇒ Object (private)
59 60 61 |
# File 'app/controllers/v0/dependents_applications_controller.rb', line 59 def dependent_service @dependent_service ||= BGS::DependentService.new(current_user) end |
#disability_rating ⇒ Object
34 35 36 37 |
# File 'app/controllers/v0/dependents_applications_controller.rb', line 34 def res = EVSS::Dependents::RetrievedInfo.for_user(current_user) render json: { has30_percent: res.body.dig('submitProcess', 'application', 'has30Percent') } end |
#show ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/controllers/v0/dependents_applications_controller.rb', line 25 def show dependents = dependent_service.get_dependents dependents[:diaries] = dependency_verification_service.read_diaries render json: DependentsSerializer.new(dependents) rescue => e log_exception_to_sentry(e) raise Common::Exceptions::BackendServiceException.new(nil, detail: e.) end |
#stats_key ⇒ Object (private)
67 68 69 |
# File 'app/controllers/v0/dependents_applications_controller.rb', line 67 def stats_key 'api.dependents_application' end |