Class: Etna::Clients::Magma::Documents

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

Returns a new instance of Documents.



307
308
309
# File 'lib/etna/clients/magma/models.rb', line 307

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

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



305
306
307
# File 'lib/etna/clients/magma/models.rb', line 305

def raw
  @raw
end

Instance Method Details

#+(other) ⇒ Object



315
316
317
# File 'lib/etna/clients/magma/models.rb', line 315

def +(other)
  Documents.new({}.update(raw).update(other.raw))
end

#document(document_key) ⇒ Object



319
320
321
322
323
324
325
# File 'lib/etna/clients/magma/models.rb', line 319

def document(document_key)
  if document_key.is_a?(String)
    raw[document_key]
  else
    raw[document_key&.to_s]
  end
end

#document_keysObject



311
312
313
# File 'lib/etna/clients/magma/models.rb', line 311

def document_keys
  raw.keys
end