Class: Decidim::DownloadYourDataSerializers::DownloadYourDataConversationSerializer

Inherits:
Exporters::Serializer
  • Object
show all
Includes:
ResourceHelper
Defined in:
lib/decidim/download_your_data_serializers/download_your_data_conversation_serializer.rb

Instance Method Summary collapse

Methods included from ResourceHelper

#linked_classes_filter_values_for, #linked_classes_for, #resource_locator

Methods inherited from Exporters::Serializer

#event_name, #finalize, #run

Constructor Details

#initialize(conversation) ⇒ DownloadYourDataConversationSerializer

Public: Initializes the serializer with a conversation.



10
11
12
# File 'lib/decidim/download_your_data_serializers/download_your_data_conversation_serializer.rb', line 10

def initialize(conversation)
  @conversation = conversation
end

Instance Method Details

#serializeObject

Public: Exports a hash with the serialized data for this conversation.



15
16
17
18
19
20
21
22
# File 'lib/decidim/download_your_data_serializers/download_your_data_conversation_serializer.rb', line 15

def serialize
  {
    id: conversation.id,
    messages:,
    created_at: conversation.created_at,
    updated_at: conversation.updated_at
  }
end