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