cartodb-4.42/app/controllers/carto/api/widget_presenter.rb
2024-04-06 05:25:13 +00:00

32 lines
588 B
Ruby

module Carto
module Api
class WidgetPresenter
def initialize(widget)
@widget = widget
end
def to_poro
return {} unless @widget
poro = {
id: @widget.id,
type: @widget.type,
title: @widget.title,
order: @widget.order,
layer_id: @widget.layer_id,
options: @widget.options,
style: @widget.style
}
poro[:source] = { id: @widget.source_id } if @widget.source_id.present?
poro
end
alias_method :to_vizjson, :to_poro
end
end
end