Sha256: 4acc6dcde5449151cc543f8f01641fc09b10d2b49c875ca56f02668b704d2aa3

Contents?: true

Size: 720 Bytes

Versions: 19

Compression:

Stored size: 720 Bytes

Contents

# frozen_string_literal: true

module ForemanWebhooks
  class DeliverWebhookJob < ::ApplicationJob
    queue_as :default

    def perform(options)
      webhook = Webhook.unscoped.find_by(id: options[:webhook_id])
      WebhookService.new(
        webhook: webhook,
        headers: options[:headers],
        url: options[:url],
        event_name: options[:event_name],
        payload: options[:payload]
      ).execute
    end

    def webhook_id
      arguments.first['webhook_id'] unless arguments.first.nil?
    end

    def humanized_name
      webhook = webhook_id && Webhook.unscoped.find_by(id: webhook_id)
      (webhook && (_('Deliver webhook %s') % webhook.name)) || _('Deliver webhook')
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
foreman_webhooks-3.1.1 app/jobs/foreman_webhooks/deliver_webhook_job.rb
foreman_webhooks-3.2.1 app/jobs/foreman_webhooks/deliver_webhook_job.rb
foreman_webhooks-3.2.0 app/jobs/foreman_webhooks/deliver_webhook_job.rb
foreman_webhooks-3.1.0 app/jobs/foreman_webhooks/deliver_webhook_job.rb
foreman_webhooks-3.0.5 app/jobs/foreman_webhooks/deliver_webhook_job.rb
foreman_webhooks-2.0.3 app/jobs/foreman_webhooks/deliver_webhook_job.rb
foreman_webhooks-3.0.4 app/jobs/foreman_webhooks/deliver_webhook_job.rb
foreman_webhooks-2.0.2 app/jobs/foreman_webhooks/deliver_webhook_job.rb
foreman_webhooks-3.0.3 app/jobs/foreman_webhooks/deliver_webhook_job.rb
foreman_webhooks-3.0.2 app/jobs/foreman_webhooks/deliver_webhook_job.rb
foreman_webhooks-3.0.1 app/jobs/foreman_webhooks/deliver_webhook_job.rb
foreman_webhooks-2.0.1 app/jobs/foreman_webhooks/deliver_webhook_job.rb
foreman_webhooks-3.0.0 app/jobs/foreman_webhooks/deliver_webhook_job.rb
foreman_webhooks-2.0.0 app/jobs/foreman_webhooks/deliver_webhook_job.rb
foreman_webhooks-1.1.0 app/jobs/foreman_webhooks/deliver_webhook_job.rb
foreman_webhooks-1.0.0 app/jobs/foreman_webhooks/deliver_webhook_job.rb
foreman_webhooks-0.0.3 app/jobs/foreman_webhooks/deliver_webhook_job.rb
foreman_webhooks-0.0.2 app/jobs/foreman_webhooks/deliver_webhook_job.rb
foreman_webhooks-0.0.1 app/jobs/foreman_webhooks/deliver_webhook_job.rb