123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- class Transaction::ClearbitEnrichment
- def initialize(item, params = {})
- @item = item
- @params = params
- end
- def perform
-
- return if Setting.get('import_mode')
- return if @item[:object] != 'User'
- return if @item[:type] != 'create'
- return if !Setting.get('clearbit_integration')
- config = Setting.get('clearbit_config')
- return if !config
- return if config['api_key'].blank?
- user = User.lookup(id: @item[:object_id])
- return if !user
- user_enrichment = Enrichment::Clearbit::User.new(user)
- return if !user_enrichment.synced?
- TransactionDispatcher.commit
- true
- end
- end
|