Repo cleanup

This commit is contained in:
Darren Clarke 2026-02-10 08:36:04 +01:00
parent 59872f579a
commit e941353b64
444 changed files with 1485 additions and 21978 deletions

View file

@ -0,0 +1,55 @@
# frozen_string_literal: true
class Channel
class Driver
class CdrSignal
def fetchable?(_channel)
false
end
def disconnect; end
#
# instance = Channel::Driver::CdrSignal.new
# instance.send(
# {
# adapter: 'cdrsignal',
# auth: {
# api_key: api_key
# },
# },
# signal_attributes,
# notification
# )
#
def deliver(options, article, _notification = false)
# return if we run import mode
return if Setting.get('import_mode')
options = check_external_credential(options)
Rails.logger.debug { 'signal send started' }
Rails.logger.debug { options.inspect }
@signal = ::CdrSignal.new(options[:bot_endpoint], options[:bot_token])
@signal.from_article(article)
end
def self.streamable?
false
end
private
def check_external_credential(options)
if options[:auth] && options[:auth][:external_credential_id]
external_credential = ExternalCredential.find_by(id: options[:auth][:external_credential_id])
raise "No such ExternalCredential.find(#{options[:auth][:external_credential_id]})" unless external_credential
options[:auth][:api_key] = external_credential.credentials['api_key']
end
options
end
end
end
end