8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/dato/utils/build_modular_block.rb', line 8
def self.build(unserialized_body)
json_api_serializer = JsonApiSerializer.new(type: "item")
attributes = json_api_serializer.serialized_attributes(unserialized_body)
payload = {
type: "item",
attributes: attributes,
relationships: {
item_type: {
data: {
id: unserialized_body[:item_type],
type: "item_type",
},
},
},
}
payload[:id] = unserialized_body[:id] if unserialized_body[:id]
payload
end
|