Class: Etna::Clients::Metis::TailResponse

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

Instance Attribute Summary collapse

Attributes inherited from Response

#raw

Instance Method Summary collapse

Methods inherited from Response

params

Constructor Details

#initialize(project_name, bucket_name, raw = {}) ⇒ TailResponse

Returns a new instance of TailResponse.



289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/etna/clients/metis/models.rb', line 289

def initialize(project_name, bucket_name, raw = {})
  super(raw)

  @paths = {}

  @parents = {}

  @project_name = project_name
  @bucket_name = bucket_name

  @nodes = []
  raw.each do |raw_node|
    node = TailNode.new(self, raw_node)
    if node.parent?
      @parents[node.id] = node
    else
      @nodes.push(node)
    end
  end
end

Instance Attribute Details

#bucket_nameObject (readonly)

Returns the value of attribute bucket_name.



286
287
288
# File 'lib/etna/clients/metis/models.rb', line 286

def bucket_name
  @bucket_name
end

#parentsObject (readonly)

Returns the value of attribute parents.



286
287
288
# File 'lib/etna/clients/metis/models.rb', line 286

def parents
  @parents
end

#pathsObject (readonly)

Returns the value of attribute paths.



286
287
288
# File 'lib/etna/clients/metis/models.rb', line 286

def paths
  @paths
end

#project_nameObject (readonly)

Returns the value of attribute project_name.



286
287
288
# File 'lib/etna/clients/metis/models.rb', line 286

def project_name
  @project_name
end

Instance Method Details

#filesObject



316
317
318
319
320
# File 'lib/etna/clients/metis/models.rb', line 316

def files
  @nodes.filter_map do |node|
    File.new(node.as_file) if node.file?
  end
end

#foldersObject



310
311
312
313
314
# File 'lib/etna/clients/metis/models.rb', line 310

def folders
  @nodes.filter_map do |node|
    Folder.new(node.as_folder) if node.folder?
  end
end