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.



204
205
206
# File 'lib/etna/clients/metis/models.rb', line 204

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

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



202
203
204
# File 'lib/etna/clients/metis/models.rb', line 202

def raw
  @raw
end

Instance Method Details

#bucket_nameObject



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

def bucket_name
  raw[:bucket_name]
end

#download_pathObject



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

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

#download_urlObject



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

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

#file_nameObject



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

def file_name
  raw[:file_name]
end

#file_pathObject



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

def file_path
  raw[:file_path]
end

#project_nameObject



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

def project_name
  raw[:project_name]
end

#sizeObject



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

def size
  raw[:size]
end

#updated_atObject



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

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