Sha256: f6fa45e0674d9b6ef5c91501debb4ab86e92c51e873a1443899a2d4f20fd3b35

Contents?: true

Size: 709 Bytes

Versions: 2

Compression:

Stored size: 709 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ParticipatoryDocuments
    # This class serializes a Suggestion so can be exported to CSV, JSON or other
    # formats.
    class MySuggestionSerializer < SuggestionSerializer
      # Public: Exports a hash with the serialized data for this suggestion.
      def serialize
        {
          id: suggestion.id,
          body: suggestion_body(suggestion),
          author: suggestion.try(:normalized_author).try(:name),
          state: humanize_suggestion_state(suggestion.state),
          answer: answer_text(suggestion),
          section: section(suggestion),
          submitted_on: submitted_on(suggestion)
        }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-participatory_documents-0.2.2 app/serializers/decidim/participatory_documents/my_suggestion_serializer.rb
decidim-participatory_documents-0.2.1 app/serializers/decidim/participatory_documents/my_suggestion_serializer.rb