Class: EVSS::DisabilityCompensationForm::UploadBddInstructions
- Extended by:
- Logging::ThirdPartyTransaction::MethodWrapper
- Defined in:
- app/sidekiq/evss/disability_compensation_form/upload_bdd_instructions.rb
Constant Summary collapse
- STATSD_KEY_PREFIX =
'worker.evss.submit_form526_bdd_instructions'
- BDD_INSTRUCTIONS_DOCUMENT_TYPE =
‘Other Correspondence’ document type
'L023'
- BDD_INSTRUCTIONS_FILE_NAME =
'BDD_Instructions.pdf'
Class Method Summary collapse
Instance Method Summary collapse
- #document_data ⇒ Object private
- #file_body ⇒ Object private
-
#perform(submission_id) ⇒ Object
Submits a BDD instruction PDF in to EVSS.
- #retryable_error_handler(error) ⇒ Object private
- #upload_bdd_instructions ⇒ Object private
Methods included from Logging::ThirdPartyTransaction::MethodWrapper
Methods inherited from Job
Methods included from Sidekiq::Form526JobStatusTracker::JobTracker
#error_message, #job_success, #job_try, #klass, #log_error, #log_info, #metrics, #non_retryable_error_handler, #update_background_job_errors, #upsert_job_status, #with_tracking
Methods included from Sidekiq::Form526JobStatusTracker::BackupSubmission
#send_backup_submission_if_enabled
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata
Class Method Details
.api_upload_provider(submission) ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'app/sidekiq/evss/disability_compensation_form/upload_bdd_instructions.rb', line 81 def self.api_upload_provider(submission) user = User.find(submission.user_uuid) ApiProviderFactory.call( type: ApiProviderFactory::FACTORIES[:supplemental_document_upload], options: { form526_submission: submission, document_type: BDD_INSTRUCTIONS_DOCUMENT_TYPE, statsd_metric_prefix: STATSD_KEY_PREFIX }, current_user: user, feature_toggle: ApiProviderFactory::FEATURE_TOGGLE_UPLOAD_BDD_INSTRUCTIONS ) end |
Instance Method Details
#document_data ⇒ Object (private)
137 138 139 140 141 142 143 144 |
# File 'app/sidekiq/evss/disability_compensation_form/upload_bdd_instructions.rb', line 137 def document_data @document_data ||= EVSSClaimDocument.new( evss_claim_id: submission.submitted_claim_id, file_name: BDD_INSTRUCTIONS_FILE_NAME, tracked_item_id: nil, document_type: BDD_INSTRUCTIONS_DOCUMENT_TYPE ) end |
#file_body ⇒ Object (private)
128 129 130 |
# File 'app/sidekiq/evss/disability_compensation_form/upload_bdd_instructions.rb', line 128 def file_body @file_body ||= File.read('lib/evss/disability_compensation_form/bdd_instructions.pdf') end |
#perform(submission_id) ⇒ Object
Submits a BDD instruction PDF in to EVSS
100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'app/sidekiq/evss/disability_compensation_form/upload_bdd_instructions.rb', line 100 def perform(submission_id) @submission_id = submission_id Sentry.(source: '526EZ-all-claims') super(submission_id) with_tracking('Form526 Upload BDD instructions:', submission.saved_claim_id, submission.id) do upload_bdd_instructions end rescue => e # Can't send a job manually to the dead set. # Log and re-raise so the job ends up in the dead set and the parent batch is not marked as complete. retryable_error_handler(e) end |
#retryable_error_handler(error) ⇒ Object (private)
132 133 134 135 |
# File 'app/sidekiq/evss/disability_compensation_form/upload_bdd_instructions.rb', line 132 def retryable_error_handler(error) super(error) raise error end |
#upload_bdd_instructions ⇒ Object (private)
117 118 119 120 121 122 123 124 125 126 |
# File 'app/sidekiq/evss/disability_compensation_form/upload_bdd_instructions.rb', line 117 def upload_bdd_instructions if Flipper.enabled?(:disability_compensation_use_api_provider_for_bdd_instructions) provider = self.class.api_upload_provider(submission) upload_document = provider.generate_upload_document(BDD_INSTRUCTIONS_FILE_NAME) provider.submit_upload_document(upload_document, file_body) else EVSS::DocumentsService.new(submission.auth_headers).upload(file_body, document_data) end end |