Sha256: a79428fa3d1bc1b88434b3aa244889c6fb02a9a686f3f5a0c7e6a07aa8f1cb4b

Contents?: true

Size: 793 Bytes

Versions: 5

Compression:

Stored size: 793 Bytes

Contents

# frozen_string_literal: true
module SocialNetworking
  module Serializers
    # Serializes Nudge models.
    class NudgeSerializer < Serializer
      def to_serialized
        recipient_profile = Profile.find_by_participant_id(model.recipient_id)

        {
          className: "SocialNetworking::Nudge",
          id: model.id,
          participantId: model.initiator_id,
          isAdmin: model.initiator.is_admin,
          createdAt: model.created_at,
          createdAtRaw: model.created_at.to_i,
          initiatorId: model.initiator_id,
          recipientId: model.recipient_id,
          summary: "nudged #{recipient_profile.user_name}",
          description: "nudge",
          comments: CommentSerializer.from_collection(model.comments)
        }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
social_networking-0.13.3 app/models/social_networking/serializers/nudge_serializer.rb
social_networking-0.13.2 app/models/social_networking/serializers/nudge_serializer.rb
social_networking-0.13.1 app/models/social_networking/serializers/nudge_serializer.rb
social_networking-0.13.0 app/models/social_networking/serializers/nudge_serializer.rb
social_networking-0.12.0 app/models/social_networking/serializers/nudge_serializer.rb