Class: ForemanWebhooks::Renderer::Scope::WebhookTemplate

Inherits:
Foreman::Renderer::Scope::Template
  • Object
show all
Extended by:
ApipieDSL::Class
Defined in:
app/lib/foreman_webhooks/renderer/scope/webhook_template.rb

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ WebhookTemplate

Returns a new instance of WebhookTemplate.



14
15
16
17
18
19
20
21
# File 'app/lib/foreman_webhooks/renderer/scope/webhook_template.rb', line 14

def initialize(**args)
  super
  @defaults = {
    event_name: @event_name,
    webhook_id: @webhook_id,
    context: @context
  }
end

Instance Method Details

#payload(hash, with_defaults: true) ⇒ Object



31
32
33
34
# File 'app/lib/foreman_webhooks/renderer/scope/webhook_template.rb', line 31

def payload(hash, with_defaults: true)
  hash.merge!(@defaults) if with_defaults
  hash.to_json
end