Sha256: d055241a2e9eb70567e5348add5c451fcfa38ad570da213ce46c041a1857248d

Contents?: true

Size: 558 Bytes

Versions: 7

Compression:

Stored size: 558 Bytes

Contents

# frozen_string_literal: true

require "active_job"
require_relative "feature_event"

module Flipper
  module Notifications
    class EventSerializer < ActiveJob::Serializers::ObjectSerializer

      def serialize?(argument)
        argument.is_a?(FeatureEvent)
      end

      def serialize(event)
        super(
          feature_name: event.feature.name,
          operation:    event.operation
        )
      end

      def deserialize(hash)
        FeatureEvent.new(**hash.symbolize_keys.slice(:feature_name, :operation))
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
flipper-notifications-0.1.7 lib/flipper/notifications/event_serializer.rb
flipper-notifications-0.1.6 lib/flipper/notifications/event_serializer.rb
flipper-notifications-0.1.5 lib/flipper/notifications/event_serializer.rb
flipper-notifications-0.1.4 lib/flipper/notifications/event_serializer.rb
flipper-notifications-0.1.3 lib/flipper/notifications/event_serializer.rb
flipper-notifications-0.1.2 lib/flipper/notifications/event_serializer.rb
flipper-notifications-0.1.1 lib/flipper/notifications/event_serializer.rb