Class: Decidim::Initiatives::InitiativeSerializer
- Inherits:
-
Exporters::Serializer
- Object
- Exporters::Serializer
- Decidim::Initiatives::InitiativeSerializer
- Defined in:
- app/serializers/decidim/initiatives/initiative_serializer.rb
Instance Method Summary collapse
-
#serialize ⇒ Object
Serializes an initiative.
Instance Method Details
#serialize ⇒ Object
Serializes an initiative
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/serializers/decidim/initiatives/initiative_serializer.rb', line 7 def serialize { id: resource.id, title: resource.title, description: resource.description, state: resource.state, created_at: resource.created_at, published_at: resource.published_at, signature_end_date: resource.signature_end_date, signature_type: resource.signature_type, signatures: resource.supports_count, scope: { name: resource.scope&.name }, type: { title: resource.type&.title }, authors: { id: resource..map(&:id), name: resource..map(&:name) }, area: { name: resource.area&.name } } end |