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