2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-08-18 17:15:46 -04:00
|
|
|
class EmbeddingSerializer < ApplicationSerializer
|
2015-08-20 13:43:12 -04:00
|
|
|
attributes :id, :fields, :base_url
|
|
|
|
attributes *Embedding.settings
|
|
|
|
|
2015-08-18 17:15:46 -04:00
|
|
|
has_many :embeddable_hosts, serializer: EmbeddableHostSerializer, embed: :ids
|
|
|
|
|
2015-08-20 13:43:12 -04:00
|
|
|
def fields
|
|
|
|
Embedding.settings
|
|
|
|
end
|
|
|
|
|
|
|
|
def read_attribute_for_serialization(attr)
|
2019-05-06 21:27:05 -04:00
|
|
|
object.respond_to?(attr) ? object.public_send(attr) : public_send(attr)
|
2015-08-18 17:15:46 -04:00
|
|
|
end
|
|
|
|
end
|