config.rb 770 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class TriggerWebhookJob::CustomPayload::Track::Config < TriggerWebhookJob::CustomPayload::Track
  3. class << self
  4. def root?
  5. true
  6. end
  7. def klass
  8. 'Struct::Config'
  9. end
  10. def functions
  11. %w[
  12. fqdn
  13. http_type
  14. ticket_hook
  15. ].freeze
  16. end
  17. def replacements(pre_defined_webhook_type:)
  18. {
  19. config: functions,
  20. }
  21. end
  22. def generate(tracks, _data)
  23. settings = {}
  24. functions.each do |setting|
  25. settings[setting] = Setting.get(setting)
  26. end
  27. Struct.new('Config', *settings.keys) if !defined?(Struct::Config)
  28. tracks[:config] = Struct::Config.new(*settings.values)
  29. end
  30. end
  31. end