Class: Services::AvailableFile
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Services::AvailableFile
- Defined in:
- app/models/services/available_file.rb
Constant Summary collapse
- STATUS_AVAILABLE =
0
- STATUS_DOWNLOADED =
1
- STATUS_INVALID =
2
- STATUS_MISSING =
3
- STATUS_UPLOADED =
4
- STATUS_UPLOAD_ERROR =
5
- STATUS_DELETED =
6
- STATUS_CLEARED =
Final status
7
Instance Method Summary collapse
- #actual_file_path ⇒ Object
- #composite_path ⇒ Object
- #download_path ⇒ Object
- #downloaded_file_exists? ⇒ Boolean
- #downloaded_file_path ⇒ Object
- #mds_analyzer ⇒ Object
- #split_path ⇒ Object
- #valid_mds_file? ⇒ Boolean
Instance Method Details
#actual_file_path ⇒ Object
55 56 57 |
# File 'app/models/services/available_file.rb', line 55 def actual_file_path composite_file_name.nil? ? downloaded_file_path : composite_path end |
#composite_path ⇒ Object
51 52 53 |
# File 'app/models/services/available_file.rb', line 51 def composite_path File.join(split_path, 'MdsFileUtils::ZipSplitter', composite_file_name) end |
#download_path ⇒ Object
43 44 45 |
# File 'app/models/services/available_file.rb', line 43 def download_path Rails.root.join("tmp", "available_file_#{id}").to_s end |
#downloaded_file_exists? ⇒ Boolean
59 60 61 |
# File 'app/models/services/available_file.rb', line 59 def downloaded_file_exists? File.exists?(downloaded_file_path) end |
#downloaded_file_path ⇒ Object
39 40 41 |
# File 'app/models/services/available_file.rb', line 39 def downloaded_file_path File.join(download_path, filename) end |
#mds_analyzer ⇒ Object
63 64 65 |
# File 'app/models/services/available_file.rb', line 63 def mds_analyzer @mds_analyzer ||= MdsFileUtils::ZipAnalyzer.new(downloaded_file_path) end |
#split_path ⇒ Object
47 48 49 |
# File 'app/models/services/available_file.rb', line 47 def split_path File.join(download_path, 'split') end |
#valid_mds_file? ⇒ Boolean
67 68 69 |
# File 'app/models/services/available_file.rb', line 67 def valid_mds_file? mds_analyzer.valid_zip? end |