2014-02-03 19:23:00 +00:00
|
|
|
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
2013-06-12 15:59:58 +00:00
|
|
|
|
2012-09-20 12:08:02 +00:00
|
|
|
class Channel < ApplicationModel
|
2012-04-13 13:51:10 +00:00
|
|
|
store :options
|
|
|
|
|
2012-04-10 14:06:46 +00:00
|
|
|
def self.fetch
|
2012-04-13 13:51:10 +00:00
|
|
|
channels = Channel.where( 'active = ? AND area LIKE ?', true, '%::Inbound' )
|
|
|
|
channels.each { |channel|
|
2012-04-10 14:06:46 +00:00
|
|
|
begin
|
2015-05-07 12:34:25 +00:00
|
|
|
c = eval 'Channel::' + channel[:adapter].upcase + '.new' # rubocop:disable Lint/Eval
|
2012-04-10 14:06:46 +00:00
|
|
|
c.fetch(channel)
|
2015-05-08 14:09:24 +00:00
|
|
|
rescue => e
|
2015-05-04 18:58:28 +00:00
|
|
|
logger.error "can't use " + 'Channel::' + channel[:adapter].upcase
|
|
|
|
logger.error e.inspect
|
|
|
|
logger.error e.backtrace
|
2014-06-22 07:00:09 +00:00
|
|
|
c.disconnect
|
2012-04-10 14:06:46 +00:00
|
|
|
end
|
|
|
|
}
|
|
|
|
end
|
2013-06-12 15:59:58 +00:00
|
|
|
end
|