Class: Etna::Clients::Metis::File
Instance Attribute Summary
Attributes inherited from Response
#raw
Instance Method Summary
collapse
Methods inherited from Response
#initialize, params
Instance Method Details
#as_magma_file_attribute ⇒ Object
382
383
384
385
386
387
|
# File 'lib/etna/clients/metis/models.rb', line 382
def as_magma_file_attribute
{
path: as_metis_url,
original_filename: file_name || ::File.basename(file_path)
}
end
|
#as_metis_url ⇒ Object
389
390
391
|
# File 'lib/etna/clients/metis/models.rb', line 389
def as_metis_url
"metis://#{project_name}/#{bucket_name}/#{file_path}"
end
|
#download_path ⇒ Object
367
368
369
370
371
|
# File 'lib/etna/clients/metis/models.rb', line 367
def download_path
raw[:download_url].nil? ?
"/#{project_name}/download/#{bucket_name}/#{file_path}" :
raw[:download_url].sub(%r!^https://[^/]*?/!, '/')
end
|
#download_url ⇒ Object
373
374
375
|
# File 'lib/etna/clients/metis/models.rb', line 373
def download_url
raw[:download_url] || ''
end
|
#updated_at ⇒ Object
377
378
379
380
|
# File 'lib/etna/clients/metis/models.rb', line 377
def updated_at
time = raw[:updated_at]
time.nil? ? nil : Time.parse(time)
end
|
#with_containing_folder(folder) ⇒ Object
358
359
360
361
362
363
|
# File 'lib/etna/clients/metis/models.rb', line 358
def with_containing_folder(folder)
folder_path = folder.is_a?(Folder) ? folder.folder_path : folder
File.new({}.update(self.raw).update({
file_path: ::File.join(folder_path, self.file_name)
}))
end
|