Class: Etna::Clients::Magma::Template

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw = {}) ⇒ Template

Returns a new instance of Template.



334
335
336
# File 'lib/etna/clients/magma/models.rb', line 334

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

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



332
333
334
# File 'lib/etna/clients/magma/models.rb', line 332

def raw
  @raw
end

Instance Method Details

#all_linked_model_namesObject



386
387
388
389
# File 'lib/etna/clients/magma/models.rb', line 386

def all_linked_model_names
  models = [ self.parent, ] + build_attributes.all.map { |v| v.link_model_name }
  models.select { |m| !m.nil? }.uniq
end

#attributesObject



370
371
372
# File 'lib/etna/clients/magma/models.rb', line 370

def attributes
  Attributes.new(raw['attributes'] ||= {})
end

#build_attributesObject



374
375
376
# File 'lib/etna/clients/magma/models.rb', line 374

def build_attributes
  Attributes.new(raw['attributes'] ||= {})
end

#build_dictionaryObject



382
383
384
# File 'lib/etna/clients/magma/models.rb', line 382

def build_dictionary
  Dictionary.new(raw['dictionary'] ||= {})
end

#dictionaryObject



378
379
380
# File 'lib/etna/clients/magma/models.rb', line 378

def dictionary
  Dictionary.new(raw['dictionary'] ||= {})
end

#identifierObject



346
347
348
# File 'lib/etna/clients/magma/models.rb', line 346

def identifier
  raw['identifier'] || ""
end

#identifier=(val) ⇒ Object



358
359
360
# File 'lib/etna/clients/magma/models.rb', line 358

def identifier=(val)
  raw['identifier'] = val
end

#nameObject



338
339
340
# File 'lib/etna/clients/magma/models.rb', line 338

def name
  raw['name'] || ""
end

#name=(val) ⇒ Object



342
343
344
# File 'lib/etna/clients/magma/models.rb', line 342

def name=(val)
  raw['name'] = val.to_s
end

#parentObject



362
363
364
# File 'lib/etna/clients/magma/models.rb', line 362

def parent
  raw['parent']
end

#parent=(val) ⇒ Object



366
367
368
# File 'lib/etna/clients/magma/models.rb', line 366

def parent=(val)
  raw['parent'] = val
end

#versionObject



350
351
352
# File 'lib/etna/clients/magma/models.rb', line 350

def version
  raw['version'] || 0
end

#version=(val) ⇒ Object



354
355
356
# File 'lib/etna/clients/magma/models.rb', line 354

def version=(val)
  raw['version'] = val
end