Class: Etna::Clients::Metis::TailNode
- Defined in:
- lib/etna/clients/metis/models.rb
Instance Attribute Summary
Attributes inherited from Response
Instance Method Summary collapse
- #as_file ⇒ Object
- #file? ⇒ Boolean
- #file_path ⇒ Object
- #folder? ⇒ Boolean
-
#initialize(tail, raw = {}) ⇒ TailNode
constructor
A new instance of TailNode.
- #parent? ⇒ Boolean
- #parent_path ⇒ Object
Methods inherited from Response
Constructor Details
#initialize(tail, raw = {}) ⇒ TailNode
Returns a new instance of TailNode.
238 239 240 241 |
# File 'lib/etna/clients/metis/models.rb', line 238 def initialize(tail, raw = {}) super(raw) @tail = tail end |
Instance Method Details
#as_file ⇒ Object
257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/etna/clients/metis/models.rb', line 257 def as_file { file_name: node_name, file_hash: file_hash, updated_at: updated_at, file_path: file_path, folder_id: parent_id, project_name: @tail.project_name, bucket_name: @tail.bucket_name, } end |
#file? ⇒ Boolean
251 252 253 |
# File 'lib/etna/clients/metis/models.rb', line 251 def file? @raw[:type] == 'file' end |
#file_path ⇒ Object
280 281 282 |
# File 'lib/etna/clients/metis/models.rb', line 280 def file_path [ parent_path, node_name ].compact.join('/') end |
#folder? ⇒ Boolean
247 248 249 |
# File 'lib/etna/clients/metis/models.rb', line 247 def folder? @raw[:type] == 'folder' end |
#parent? ⇒ Boolean
243 244 245 |
# File 'lib/etna/clients/metis/models.rb', line 243 def parent? @raw[:type] == 'parent' end |
#parent_path ⇒ Object
269 270 271 272 273 274 275 276 277 278 |
# File 'lib/etna/clients/metis/models.rb', line 269 def parent_path return nil if !parent_id if !@tail.paths[parent_id] parent = @tail.parents[parent_id] @tail.paths[parent_id] = parent.file_path end return @tail.paths[parent_id] end |