2019-05-12 22:37:49 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-12-29 07:31:05 -05:00
|
|
|
require_relative "./rule_serializer"
|
2017-07-18 11:17:03 -04:00
|
|
|
|
2021-07-13 15:36:16 -04:00
|
|
|
class DiscourseChatIntegration::ChannelSerializer < ApplicationSerializer
|
2018-08-20 07:05:59 -04:00
|
|
|
attributes :id, :provider, :error_key, :error_info, :data, :rules
|
2017-07-18 11:17:03 -04:00
|
|
|
|
|
|
|
def rules
|
2017-07-18 16:36:07 -04:00
|
|
|
object.rules.order_by_precedence.map do |rule|
|
2021-07-13 15:36:16 -04:00
|
|
|
DiscourseChatIntegration::RuleSerializer.new(rule, root: false)
|
2017-07-18 11:17:03 -04:00
|
|
|
end
|
|
|
|
end
|
2017-08-01 15:53:39 -04:00
|
|
|
end
|