Sha256: b59dfd6bb8e3ce567af94b9edd9010957ee77dc073ce0b6438cb4f542c36b9eb

Contents?: true

Size: 765 Bytes

Versions: 11

Compression:

Stored size: 765 Bytes

Contents

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

11 entries across 11 versions & 1 rubygems

Version Path
social_networking-0.11.8 app/models/social_networking/serializers/nudge_serializer.rb
social_networking-0.11.7 app/models/social_networking/serializers/nudge_serializer.rb
social_networking-0.11.6 app/models/social_networking/serializers/nudge_serializer.rb
social_networking-0.11.5 app/models/social_networking/serializers/nudge_serializer.rb
social_networking-0.11.4 app/models/social_networking/serializers/nudge_serializer.rb
social_networking-0.11.3 app/models/social_networking/serializers/nudge_serializer.rb
social_networking-0.11.2 app/models/social_networking/serializers/nudge_serializer.rb
social_networking-0.11.1 app/models/social_networking/serializers/nudge_serializer.rb
social_networking-0.11.0 app/models/social_networking/serializers/nudge_serializer.rb
social_networking-0.10.0 app/models/social_networking/serializers/nudge_serializer.rb
social_networking-0.9.3 app/models/social_networking/serializers/nudge_serializer.rb