Sha256: b8f69e607989532fa2bccec06f35eae3196149567cc8f30785e04f002adecd63

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

module Maestrano::Connector::Rails::Concerns::EntityBase
  extend ActiveSupport::Concern

  def initialize(organization, connec_client, external_client, opts={})
    @organization = organization
    @connec_client = connec_client
    @external_client = external_client
    @opts = opts
  end

  def opts_merge!(opts)
    @opts.merge!(opts)
  end

  def before_sync(last_synchronization_date)
    # Does nothing by default
  end

  def after_sync(last_synchronization_date)
    # Does nothing by default
  end

  # This method is called during the webhook workflow only. It should return the hash of arrays of filtered entities
  # The aim is to have the same filtering as with the Connec! filters on API calls in the webhooks
  # input :  
  # For non complex entities [unmapped_external_entity1, unmapped_external_entity2]
  # For complex entities {
  #   external_entities_names[0]: [unmapped_external_entity1, unmapped_external_entity2],
  #   external_entities_names[1]: [unmapped_external_entity3, unmapped_external_entity4]
  # }
  def filter_connec_entities(entities)
    entities
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
maestrano-connector-rails-1.2.1 app/models/maestrano/connector/rails/concerns/entity_base.rb
maestrano-connector-rails-1.2.0 app/models/maestrano/connector/rails/concerns/entity_base.rb