Class: Flipper::Notifications::Webhooks::Serializer
- Inherits:
-
ActiveJob::Serializers::ObjectSerializer
- Object
- ActiveJob::Serializers::ObjectSerializer
- Flipper::Notifications::Webhooks::Serializer
- Defined in:
- lib/flipper/notifications/webhooks/serializer.rb
Instance Method Summary collapse
- #deserialize(hash) ⇒ Object
- #klass ⇒ Object
- #serialize(webhook) ⇒ Object
- #serialize?(argument) ⇒ Boolean
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 |
#klass ⇒ Object
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
15 16 17 |
# File 'lib/flipper/notifications/webhooks/serializer.rb', line 15 def serialize?(argument) argument.is_a?(Webhook) end |