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.
278 279 280 |
# File 'lib/etna/clients/magma/models.rb', line 278 def initialize(raw = {}) @raw = raw end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
276 277 278 |
# File 'lib/etna/clients/magma/models.rb', line 276 def raw @raw end |
Instance Method Details
#build_template ⇒ Object
282 283 284 |
# File 'lib/etna/clients/magma/models.rb', line 282 def build_template Template.new(raw['template'] ||= {}) end |
#count ⇒ Object
298 299 300 |
# File 'lib/etna/clients/magma/models.rb', line 298 def count raw['count'] || 0 end |
#documents ⇒ Object
286 287 288 |
# File 'lib/etna/clients/magma/models.rb', line 286 def documents Documents.new(raw['documents']) end |
#name ⇒ Object
294 295 296 |
# File 'lib/etna/clients/magma/models.rb', line 294 def name @raw.dig('template', 'name') end |