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.
271 272 273 |
# File 'lib/etna/clients/magma/models.rb', line 271 def initialize(raw = {}) @raw = raw end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
269 270 271 |
# File 'lib/etna/clients/magma/models.rb', line 269 def raw @raw end |
Instance Method Details
#build_template ⇒ Object
275 276 277 |
# File 'lib/etna/clients/magma/models.rb', line 275 def build_template Template.new(raw['template'] ||= {}) end |
#count ⇒ Object
291 292 293 |
# File 'lib/etna/clients/magma/models.rb', line 291 def count raw['count'] || 0 end |
#documents ⇒ Object
279 280 281 |
# File 'lib/etna/clients/magma/models.rb', line 279 def documents Documents.new(raw['documents']) end |
#name ⇒ Object
287 288 289 |
# File 'lib/etna/clients/magma/models.rb', line 287 def name @raw.dig('template', 'name') end |