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.



224
225
226
# File 'lib/etna/clients/metis/models.rb', line 224

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

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



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

def raw
  @raw
end

Instance Method Details

#bucket_nameObject



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

def bucket_name
  raw[:bucket_name]
end

#download_pathObject



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

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

#download_urlObject



246
247
248
# File 'lib/etna/clients/metis/models.rb', line 246

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

#file_nameObject



250
251
252
# File 'lib/etna/clients/metis/models.rb', line 250

def file_name
  raw[:file_name]
end

#file_pathObject



228
229
230
# File 'lib/etna/clients/metis/models.rb', line 228

def file_path
  raw[:file_path]
end

#project_nameObject



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

def project_name
  raw[:project_name]
end

#sizeObject



259
260
261
# File 'lib/etna/clients/metis/models.rb', line 259

def size
  raw[:size]
end

#updated_atObject



254
255
256
257
# File 'lib/etna/clients/metis/models.rb', line 254

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