Skip to content

Conversation

@alexandrebk
Copy link
Contributor

@alexandrebk alexandrebk commented Oct 3, 2025

#8

@alexandrebk alexandrebk changed the title refactor: use as_crm_payload by default for serializer [refactor] use as_crm_payload by default for serializer Oct 3, 2025
if serializer.respond_to?(:to_h)
serializer.to_h
else serializer.respond_to?(:as_crm_payload)
else
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si pas de méthode to_h alors on appel as_crm_payload

Comme il hérite de module Etlify::Serializer::BaseSerializer si la méthode est manquante ça va raise une erreur.

module Etlify
  module Serializers
    class BaseSerializer
      attr_reader :record

      def initialize(record)
        @record = record
      end
      # @returns [Hash] serialized and stable payload
      def as_crm_payload
        raise NotImplementedError
      end
    end
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants