Class: Services::AvailableFile

Inherits:
ActiveRecord::Base
  • Object
show all
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

Instance Method Details

#actual_file_pathObject



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_pathObject



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_pathObject



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

Returns:

  • (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_pathObject



39
40
41
# File 'app/models/services/available_file.rb', line 39

def downloaded_file_path
  File.join(download_path, filename)
end

#mds_analyzerObject



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_pathObject



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

Returns:

  • (Boolean)


67
68
69
# File 'app/models/services/available_file.rb', line 67

def valid_mds_file?
  mds_analyzer.valid_zip?
end