Class: Flipper::Notifications::Webhooks::Serializer

Inherits:
ActiveJob::Serializers::ObjectSerializer
  • Object
show all
Defined in:
lib/flipper/notifications/webhooks/serializer.rb

Instance Method Summary collapse

Instance Method Details

#deserialize(hash) ⇒ Object



26
27
28
# File 'lib/flipper/notifications/webhooks/serializer.rb', line 26

def deserialize(hash)
  hash["class"].constantize.new(**hash["attributes"].deep_symbolize_keys)
end

#klassObject



11
12
13
# File 'lib/flipper/notifications/webhooks/serializer.rb', line 11

def klass
  Webhook
end

#serialize(webhook) ⇒ Object



19
20
21
22
23
24
# File 'lib/flipper/notifications/webhooks/serializer.rb', line 19

def serialize(webhook)
  super(
    "class"      => webhook.class.name,
    "attributes" => webhook.serialized_attributes
  )
end

#serialize?(argument) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/flipper/notifications/webhooks/serializer.rb', line 15

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