2016-11-13 14:35:47 -05:00
|
|
|
# Base class for Chat services
|
2016-11-14 06:41:14 -05:00
|
|
|
# This class is not meant to be used directly, but only to inherrit from.
|
2016-11-13 14:35:47 -05:00
|
|
|
class ChatService < Service
|
|
|
|
default_value_for :category, 'chat'
|
|
|
|
|
2016-11-14 09:10:35 -05:00
|
|
|
has_many :chat_names, foreign_key: :service_id
|
2016-11-13 14:35:47 -05:00
|
|
|
|
|
|
|
def valid_token?(token)
|
2016-11-14 09:10:35 -05:00
|
|
|
self.respond_to?(:token) &&
|
|
|
|
self.token.present? &&
|
|
|
|
ActiveSupport::SecurityUtils.variable_size_secure_compare(token, self.token)
|
2016-11-13 14:35:47 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def supported_events
|
2016-11-14 09:10:35 -05:00
|
|
|
[]
|
2016-11-13 14:35:47 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def trigger(params)
|
2016-11-14 06:41:14 -05:00
|
|
|
raise NotImplementedError
|
2016-11-13 14:35:47 -05:00
|
|
|
end
|
|
|
|
end
|