Class: BulkImports::FileDownloadService
- Inherits:
-
Object
- Object
- BulkImports::FileDownloadService
- Defined in:
- app/services/bulk_imports/file_download_service.rb
Constant Summary collapse
- ServiceError =
Class.new(StandardError)
- DEFAULT_ALLOWED_CONTENT_TYPES =
%w[application/gzip application/octet-stream].freeze
- LAST_CHUNK_CONTEXT_CHAR_LIMIT =
200
Constants included from BulkImports::FileDownloads::FilenameFetch
BulkImports::FileDownloads::FilenameFetch::FILENAME_SIZE_LIMIT, BulkImports::FileDownloads::FilenameFetch::REMOTE_FILENAME_PATTERN
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(configuration:, relative_url:, tmpdir:, file_size_limit: default_file_size_limit, allowed_content_types: DEFAULT_ALLOWED_CONTENT_TYPES, filename: nil) ⇒ FileDownloadService
constructor
A new instance of FileDownloadService.
Constructor Details
#initialize(configuration:, relative_url:, tmpdir:, file_size_limit: default_file_size_limit, allowed_content_types: DEFAULT_ALLOWED_CONTENT_TYPES, filename: nil) ⇒ FileDownloadService
Returns a new instance of FileDownloadService.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/services/bulk_imports/file_download_service.rb', line 21 def initialize( configuration:, relative_url:, tmpdir:, file_size_limit: default_file_size_limit, allowed_content_types: DEFAULT_ALLOWED_CONTENT_TYPES, filename: nil) @configuration = configuration @relative_url = relative_url @filename = filename @tmpdir = tmpdir @file_size_limit = file_size_limit @allowed_content_types = allowed_content_types @remote_content_validated = false end |
Instance Method Details
#execute ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/services/bulk_imports/file_download_service.rb', line 37 def execute validate_tmpdir validate_filepath validate_url download_file validate_symlink filepath end |