Class: Etna::Clients::Magma::Model
- Inherits:
-
Object
- Object
- Etna::Clients::Magma::Model
- Defined in:
- lib/etna/clients/magma/models.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #build_template ⇒ Object
- #count ⇒ Object
- #documents ⇒ Object
-
#initialize(raw = {}) ⇒ Model
constructor
A new instance of Model.
- #name ⇒ Object
- #template ⇒ Object
Constructor Details
#initialize(raw = {}) ⇒ Model
Returns a new instance of Model.
316 317 318 |
# File 'lib/etna/clients/magma/models.rb', line 316 def initialize(raw = {}) @raw = raw end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
314 315 316 |
# File 'lib/etna/clients/magma/models.rb', line 314 def raw @raw end |
Instance Method Details
#build_template ⇒ Object
320 321 322 |
# File 'lib/etna/clients/magma/models.rb', line 320 def build_template Template.new(raw['template'] ||= {}) end |
#count ⇒ Object
336 337 338 |
# File 'lib/etna/clients/magma/models.rb', line 336 def count raw['count'] || 0 end |
#documents ⇒ Object
324 325 326 |
# File 'lib/etna/clients/magma/models.rb', line 324 def documents Documents.new(raw['documents']) end |
#name ⇒ Object
332 333 334 |
# File 'lib/etna/clients/magma/models.rb', line 332 def name @raw.dig('template', 'name') end |