Class: EVSSClaimDocumentUploader

Inherits:
EVSSClaimDocumentUploaderBase show all
Defined in:
app/uploaders/evss_claim_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 EVSSClaimDocumentUploaderBase

#extension_allowlist, #max_file_size_non_pdf, #size_range, #validate_file_size

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(user_uuid, ids) ⇒ EVSSClaimDocumentUploader

Returns a new instance of EVSSClaimDocumentUploader.



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

def initialize(user_uuid, 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
  @user_uuid = user_uuid
  @ids = ids
  set_storage_options!
end

Instance Method Details

#move_to_cacheObject



23
24
25
# File 'app/uploaders/evss_claim_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/evss_claim_document_uploader.rb', line 29

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

#store_dirObject



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

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