Class: Decidim::DownloadYourDataSerializers::DownloadYourDataUserSerializer

Inherits:
Exporters::Serializer show all
Includes:
ResourceHelper, TranslatableAttributes
Defined in:
lib/decidim/download_your_data_serializers/download_your_data_user_serializer.rb

Instance Attribute Summary

Attributes inherited from Exporters::Serializer

#resource

Instance Method Summary collapse

Methods included from TranslatableAttributes

#default_locale?

Methods included from ResourceHelper

#linked_classes_filter_values_for, #linked_classes_for, #resource_locator

Methods inherited from Exporters::Serializer

#event_name, #finalize, #initialize, #run

Constructor Details

This class inherits a constructor from Decidim::Exporters::Serializer

Instance Method Details

#serializeObject

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



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/decidim/download_your_data_serializers/download_your_data_user_serializer.rb', line 11

def serialize
  {
    id: resource.id,
    email: resource.email,
    name: resource.name,
    nickname: resource.nickname,
    locale: resource.locale,
    organization: {
      id: resource.organization.try(:id),
      name: translated_attribute(resource.organization.try(:name))
    },
    newsletter_notifications_at: resource.newsletter_notifications_at,
    notifications_sending_frequency: resource.notifications_sending_frequency,
    admin: resource.admin,
    personal_url: resource.personal_url,
    about: resource.about,
    invitation_created_at: resource.invitation_created_at,
    invitation_sent_at: resource.invitation_sent_at,
    invitation_accepted_at: resource.invitation_accepted_at,
    invited_by: {
      id: resource.invited_by_id,
      type: resource.invited_by_type
    },
    invitations_count: resource.invitations_count,
    reset_password_sent_at: resource.reset_password_sent_at,
    remember_created_at: resource.remember_created_at,
    sign_in_count: resource.,
    current_sign_in_at: resource.,
    last_sign_in_at: resource.,
    current_sign_in_ip: resource.,
    last_sign_in_ip: resource.,
    created_at: resource.created_at,
    updated_at: resource.updated_at,
    confirmed_at: resource.confirmed_at,
    confirmation_sent_at: resource.confirmation_sent_at,
    unconfirmed_email: resource.unconfirmed_email,
    delete_reason: resource.delete_reason,
    deleted_at: resource.deleted_at,
    managed: resource.managed,
    officialized_at: resource.officialized_at,
    officialized_as: resource.officialized_as
  }
end