2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-15 13:49:57 -04:00
|
|
|
class AdminWebHookSerializer < ApplicationSerializer
|
|
|
|
attributes :id,
|
|
|
|
:payload_url,
|
|
|
|
:content_type,
|
|
|
|
:last_delivery_status,
|
|
|
|
:secret,
|
|
|
|
:wildcard_web_hook,
|
|
|
|
:verify_certificate,
|
2024-07-01 16:08:48 -04:00
|
|
|
:active
|
2016-06-15 13:49:57 -04:00
|
|
|
|
2024-04-11 17:11:00 -04:00
|
|
|
has_many :categories, serializer: BasicCategorySerializer, embed: :ids, include: true
|
2018-12-05 04:14:06 -05:00
|
|
|
has_many :tags,
|
|
|
|
key: :tag_names,
|
|
|
|
serializer: TagSerializer,
|
|
|
|
embed: :ids,
|
|
|
|
embed_key: :name,
|
|
|
|
include: false
|
2016-06-15 13:49:57 -04:00
|
|
|
has_many :groups, serializer: BasicGroupSerializer, embed: :ids, include: false
|
2024-07-01 16:08:48 -04:00
|
|
|
has_many :web_hook_event_types,
|
|
|
|
serializer: WebHookEventTypeSerializer,
|
|
|
|
root: false,
|
|
|
|
embed: :objects
|
2019-03-21 11:13:09 -04:00
|
|
|
|
|
|
|
def last_delivery_status
|
|
|
|
object.active ? object.last_delivery_status : WebHook.last_delivery_statuses[:disabled]
|
|
|
|
end
|
2016-06-15 13:49:57 -04:00
|
|
|
end
|