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