2019-05-12 22:37:49 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-07-18 11:17:03 -04:00
|
|
|
require_relative './rule_serializer'
|
|
|
|
|
|
|
|
class DiscourseChat::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|
|
2017-08-01 15:53:39 -04:00
|
|
|
DiscourseChat::RuleSerializer.new(rule, root: false)
|
2017-07-18 11:17:03 -04:00
|
|
|
end
|
|
|
|
end
|
2017-08-01 15:53:39 -04:00
|
|
|
end
|