Class: Decidim::Exporters::OpenDataBlockedUserSerializer
- Inherits:
-
Serializer
- Object
- Serializer
- Decidim::Exporters::OpenDataBlockedUserSerializer
- Defined in:
- decidim-core/app/serializers/decidim/exporters/open_data_blocked_user_serializer.rb
Instance Attribute Summary
Attributes inherited from Serializer
Instance Method Summary collapse
-
#initialize(resource) ⇒ OpenDataBlockedUserSerializer
constructor
Public: Initializes the serializer with a resource.
-
#serialize ⇒ Object
Public: Exports a hash with the serialized data for this resource.
Methods inherited from Serializer
Constructor Details
#initialize(resource) ⇒ OpenDataBlockedUserSerializer
Public: Initializes the serializer with a resource
7 8 9 |
# File 'decidim-core/app/serializers/decidim/exporters/open_data_blocked_user_serializer.rb', line 7 def initialize(resource) @resource = resource end |
Instance Method Details
#serialize ⇒ Object
Public: Exports a hash with the serialized data for this resource.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'decidim-core/app/serializers/decidim/exporters/open_data_blocked_user_serializer.rb', line 12 def serialize { user_id: resource.user.id, blocked_at: resource.user.blocked_at, about: resource.user.about, reasons: resource.reports.map(&:reason), details: resource.reports.map(&:details), block_reasons: resource.blocking.justification, blocking_user: resource.blocking.blocking_user.presenter.name } end |