Sha256: 00f168af9f6e58cf0fbad1324cc6b33855a0c6ba13ebe455da55df2805f95338

Contents?: true

Size: 963 Bytes

Versions: 44

Compression:

Stored size: 963 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Initiatives
    class InitiativeSerializer < Decidim::Exporters::Serializer
      # Serializes an inititative
      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.author_users.map(&:id),
            name: resource.author_users.map(&:name)
          },
          area: {
            name: resource.area&.name
          }
        }
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
decidim-initiatives-0.28.4 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.27.9 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.28.3 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.27.8 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.28.2 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.27.7 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.28.1 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.27.6 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.26.10 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.26.9 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.28.0 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.27.5 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.28.0.rc5 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.28.0.rc4 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.26.8 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.27.4 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.27.3 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.26.7 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.26.5 app/serializers/decidim/initiatives/initiative_serializer.rb
decidim-initiatives-0.27.2 app/serializers/decidim/initiatives/initiative_serializer.rb