Class: Etna::Clients::Magma::Attributes

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 = {}) ⇒ Attributes

Returns a new instance of Attributes.



420
421
422
# File 'lib/etna/clients/magma/models.rb', line 420

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

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



418
419
420
# File 'lib/etna/clients/magma/models.rb', line 418

def raw
  @raw
end

Instance Method Details

#allObject



437
438
439
# File 'lib/etna/clients/magma/models.rb', line 437

def all
  raw.values.map { |r| Attribute.new(r) }
end

#attribute(attribute_key) ⇒ Object



428
429
430
431
# File 'lib/etna/clients/magma/models.rb', line 428

def attribute(attribute_key)
  return nil unless raw.include?(attribute_key)
  Attribute.new(raw[attribute_key])
end

#attribute_keysObject



424
425
426
# File 'lib/etna/clients/magma/models.rb', line 424

def attribute_keys
  raw.keys
end

#build_attribute(key) ⇒ Object



433
434
435
# File 'lib/etna/clients/magma/models.rb', line 433

def build_attribute(key)
  Attribute.new(raw[key] ||= {})
end