Class: Etna::Clients::Metis::File

Inherits:
Object
  • Object
show all
Defined in:
lib/etna/clients/metis/models.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw = {}) ⇒ File

Returns a new instance of File.



209
210
211
# File 'lib/etna/clients/metis/models.rb', line 209

def initialize(raw = {})
  @raw = raw
end

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



207
208
209
# File 'lib/etna/clients/metis/models.rb', line 207

def raw
  @raw
end

Instance Method Details

#bucket_nameObject



221
222
223
# File 'lib/etna/clients/metis/models.rb', line 221

def bucket_name
  raw[:bucket_name]
end

#download_pathObject



225
226
227
228
229
# File 'lib/etna/clients/metis/models.rb', line 225

def download_path
  raw[:download_url].nil? ?
      "/#{project_name}/download/#{bucket_name}/#{file_path}" :
      raw[:download_url].sub(%r!^https://[^/]*?/!, '/')
end

#download_urlObject



231
232
233
# File 'lib/etna/clients/metis/models.rb', line 231

def download_url
  raw[:download_url] || ''
end

#file_nameObject



235
236
237
# File 'lib/etna/clients/metis/models.rb', line 235

def file_name
  raw[:file_name]
end

#file_pathObject



213
214
215
# File 'lib/etna/clients/metis/models.rb', line 213

def file_path
  raw[:file_path]
end

#project_nameObject



217
218
219
# File 'lib/etna/clients/metis/models.rb', line 217

def project_name
  raw[:project_name]
end

#sizeObject



244
245
246
# File 'lib/etna/clients/metis/models.rb', line 244

def size
  raw[:size]
end

#updated_atObject



239
240
241
242
# File 'lib/etna/clients/metis/models.rb', line 239

def updated_at
  time = raw[:updated_at]
  time.nil? ? nil : Time.parse(time)
end