Class: Desiru::Jobs::WebhookConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/desiru/jobs/webhook_notifier.rb

Overview

Configuration for webhook notifications

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWebhookConfig

Returns a new instance of WebhookConfig.



128
129
130
131
132
133
134
135
# File 'lib/desiru/jobs/webhook_notifier.rb', line 128

def initialize
  @enabled = false
  @url = nil
  @secret = nil
  @events = %i[completed failed] # Which events to notify on
  @include_payload = true # Include job result in webhook
  @custom_headers = {}
end

Instance Attribute Details

#custom_headersObject

Returns the value of attribute custom_headers.



126
127
128
# File 'lib/desiru/jobs/webhook_notifier.rb', line 126

def custom_headers
  @custom_headers
end

#enabledObject

Returns the value of attribute enabled.



126
127
128
# File 'lib/desiru/jobs/webhook_notifier.rb', line 126

def enabled
  @enabled
end

#eventsObject

Returns the value of attribute events.



126
127
128
# File 'lib/desiru/jobs/webhook_notifier.rb', line 126

def events
  @events
end

#include_payloadObject

Returns the value of attribute include_payload.



126
127
128
# File 'lib/desiru/jobs/webhook_notifier.rb', line 126

def include_payload
  @include_payload
end

#secretObject

Returns the value of attribute secret.



126
127
128
# File 'lib/desiru/jobs/webhook_notifier.rb', line 126

def secret
  @secret
end

#urlObject

Returns the value of attribute url.



126
127
128
# File 'lib/desiru/jobs/webhook_notifier.rb', line 126

def url
  @url
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


137
138
139
# File 'lib/desiru/jobs/webhook_notifier.rb', line 137

def valid?
  enabled && url && !url.empty?
end