Class: Decidim::DataPortabilitySerializers::DataPortabilityConversationSerializer

Inherits:
Exporters::Serializer
  • Object
show all
Includes:
ResourceHelper
Defined in:
decidim-core/lib/decidim/data_portability_serializers/data_portability_conversation_serializer.rb

Instance Method Summary collapse

Methods included from ResourceHelper

#linked_classes_filter_values_for, #linked_classes_for, #linked_resources_for, #resource_locator, #resource_title

Methods inherited from Exporters::Serializer

#event_name, #finalize, #run

Constructor Details

#initialize(conversation) ⇒ DataPortabilityConversationSerializer

Public: Initializes the serializer with a conversation.


10
11
12
# File 'decidim-core/lib/decidim/data_portability_serializers/data_portability_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 'decidim-core/lib/decidim/data_portability_serializers/data_portability_conversation_serializer.rb', line 15

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