Class: Interfacets::Server::Facets::Deserializer

Inherits:
Object
  • Object
show all
Defined in:
lib/interfacets/server/facets/deserializer.rb

Class Method Summary collapse

Class Method Details

.call(data:, config:) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/interfacets/server/facets/deserializer.rb', line 8

def call(data:, config:)
  facet_class_name = data.fetch("facet_class")
  attributes = data.fetch("attributes")

  facet = (
    config
      .facet(facet_class_name)
      .build(attributes.fetch("id"))
  )

  facet.entity.ingest(attributes)
  facet
end