Class: EVSSClaimDocumentUploaderBase

Inherits:
CarrierWave::Uploader::Base
  • Object
show all
Includes:
CarrierWave::MiniMagick, ConvertFileType, SetAWSConfig, ValidatePdf
Defined in:
app/uploaders/evss_claim_document_uploader_base.rb

Instance Method Summary collapse

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

Instance Method Details

#extension_allowlistObject



29
30
31
# File 'app/uploaders/evss_claim_document_uploader_base.rb', line 29

def extension_allowlist
  %w[pdf gif png tiff tif jpeg jpg bmp txt]
end

#max_file_size_non_pdfObject



33
34
35
# File 'app/uploaders/evss_claim_document_uploader_base.rb', line 33

def max_file_size_non_pdf
  50.megabytes
end

#size_rangeObject



25
26
27
# File 'app/uploaders/evss_claim_document_uploader_base.rb', line 25

def size_range
  1.byte...99.megabytes
end

#validate_file_size(file) ⇒ Object

EVSS will split PDF’s larger than 50mb before sending to VBA who has a limit of 50mb. so, PDF’s can be larger than other files



39
40
41
42
43
44
# File 'app/uploaders/evss_claim_document_uploader_base.rb', line 39

def validate_file_size(file)
  if file.content_type != 'application/pdf' && file.size > max_file_size_non_pdf
    raise CarrierWave::IntegrityError, I18n.t(:'errors.messages.max_size_error',
                                              max_size: '50MB')
  end
end