Class: LighthouseDocumentUploader

Inherits:
LighthouseDocumentUploaderBase show all
Defined in:
app/uploaders/lighthouse_document_uploader.rb

Overview

Files that will be associated with a previously submitted claim, from the Claim Status tool

Instance Method Summary collapse

Methods inherited from LighthouseDocumentUploaderBase

#extension_allowlist, #max_file_size_non_pdf, #size_range, #validate_file_size

Methods included from UploaderVirusScan

#validate_virus_free

Methods included from ConvertFileType

#converted_exists?, #final_filename, #read_for_upload, #tiff?, #tiff_or_incorrect_extension?

Methods included from ValidatePdf

#validate, #validate_pdf

Methods included from SetAWSConfig

#set_aws_config

Constructor Details

#initialize(icn, ids) ⇒ LighthouseDocumentUploader

Returns a new instance of LighthouseDocumentUploader.



5
6
7
8
9
10
11
12
13
# File 'app/uploaders/lighthouse_document_uploader.rb', line 5

def initialize(icn, ids)
  # carrierwave allows only 2 arguments, which they will pass onto
  # different versions by calling the initialize function again,
  # that's why i put all ids in the 2nd argument instead of adding a 3rd argument
  super
  @icn = icn
  @ids = ids
  set_storage_options!
end

Instance Method Details

#move_to_cacheObject



23
24
25
# File 'app/uploaders/lighthouse_document_uploader.rb', line 23

def move_to_cache
  false
end

#set_storage_options!Object (private)



29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/uploaders/lighthouse_document_uploader.rb', line 29

def set_storage_options!
  if Settings.lighthouse.s3.uploads_enabled
    set_aws_config(
      Settings.lighthouse.s3.aws_access_key_id,
      Settings.lighthouse.s3.aws_secret_access_key,
      Settings.lighthouse.s3.region,
      Settings.lighthouse.s3.bucket
    )
  else
    self.class.storage = :file
  end
end

#store_dirObject



15
16
17
18
19
20
21
# File 'app/uploaders/lighthouse_document_uploader.rb', line 15

def store_dir
  store_dir = "lighthouse_documents/#{@icn}"
  @ids.compact.each do |id|
    store_dir += "/#{id}"
  end
  store_dir
end