Class: SubmissionPdfUrlService

Inherits:
Object
  • Object
show all
Defined in:
app/services/submission_pdf_url_service.rb

Constant Summary collapse

VFF_FORMS =
%w[20-10206 20-10207 21-0845 21-0966 21-0972 21-10210 21-4138 21-4142 21P-0847 26-4555 40-0247
40-10007].freeze

Instance Method Summary collapse

Constructor Details

#initialize(form_id:, submission_guid:) ⇒ SubmissionPdfUrlService

Returns a new instance of SubmissionPdfUrlService.



9
10
11
12
# File 'app/services/submission_pdf_url_service.rb', line 9

def initialize(form_id:, submission_guid:)
  @form_id = form_id
  @submission_guid = submission_guid
end

Instance Method Details

#determine_configObject (private)



21
22
23
24
25
# File 'app/services/submission_pdf_url_service.rb', line 21

def determine_config
  return SimpleFormsApi::FormRemediation::Configuration::VffConfig.new if VFF_FORMS.include?(@form_id)

  raise Common::Exceptions::Forbidden, detail: "Form '#{@form_id}' does not support pdf downloads"
end

#fetch_urlObject



14
15
16
17
# File 'app/services/submission_pdf_url_service.rb', line 14

def fetch_url
  config = determine_config
  SimpleFormsApi::FormRemediation::S3Client.fetch_presigned_url(@submission_guid, config:)
end