Class: Decidim::Exporters::OpenDataTaxonomySerializer
- Inherits:
-
Serializer
- Object
- Serializer
- Decidim::Exporters::OpenDataTaxonomySerializer
- Defined in:
- decidim-core/app/serializers/decidim/exporters/open_data_taxonomy_serializer.rb
Instance Attribute Summary
Attributes inherited from Serializer
Instance Method Summary collapse
-
#initialize(resource) ⇒ OpenDataTaxonomySerializer
constructor
Public: Initializes the serializer with a resource.
-
#serialize ⇒ Object
Public: Exports a hash with the serialized data for this resource.
Methods inherited from Serializer
Constructor Details
#initialize(resource) ⇒ OpenDataTaxonomySerializer
Public: Initializes the serializer with a resource
7 8 9 |
# File 'decidim-core/app/serializers/decidim/exporters/open_data_taxonomy_serializer.rb', line 7 def initialize(resource) @resource = resource end |
Instance Method Details
#serialize ⇒ Object
Public: Exports a hash with the serialized data for this resource.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'decidim-core/app/serializers/decidim/exporters/open_data_taxonomy_serializer.rb', line 12 def serialize { id: resource.id, name: resource.name, parent_id: resource.parent_id, weight: resource.weight, children_count: resource.children_count, taxonomizations_count: resource.taxonomizations_count, created_at: resource.created_at, updated_at: resource.updated_at, filters_count: resource.filters_count, filter_items_count: resource.filter_items_count, part_of: resource.part_of, is_root: resource.root? } end |