Method: Webhookdb::Replicator::Base#_prepare_for_insert

Defined in:
lib/webhookdb/replicator/base.rb

#_prepare_for_insert(resource, event, request, enrichment) ⇒ Hash

Return the hash that should be inserted into the database, based on the denormalized columns and data given.

Parameters:

Returns:

  • (Hash)


807
808
809
810
811
812
813
814
# File 'lib/webhookdb/replicator/base.rb', line 807

def _prepare_for_insert(resource, event, request, enrichment)
  h = [self._remote_key_column].concat(self._denormalized_columns).each_with_object({}) do |col, memo|
    value = col.to_ruby_value(resource:, event:, enrichment:, service_integration:)
    skip = value.nil? && col.skip_nil?
    memo[col.name] = value unless skip
  end
  return h
end