Sha256: 644327d5b6f98464e34f1c6b56f59b4d94daba59e4cc01f0b803454a3e698a5e

Contents?: true

Size: 562 Bytes

Versions: 3

Compression:

Stored size: 562 Bytes

Contents

# frozen_string_literal: true

module Emailbutler
  class WebhooksController < Emailbutler::ApplicationController
    skip_before_action(*Emailbutler.configuration.skip_before_actions)

    def create
      ::Emailbutler::Webhooks::Receiver.call(
        user_agent: request.headers['HTTP_USER_AGENT'],
        payload: receiver_params.to_h
      )

      head :ok
    end

    private

    def receiver_params
      params.permit(
        'event', 'sendtime', 'message-id',
        '_json' => %w[event timestamp smtp-id sg_message_id]
      )
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
emailbutler-0.7.2 app/controllers/emailbutler/webhooks_controller.rb
emailbutler-0.7.1 app/controllers/emailbutler/webhooks_controller.rb
emailbutler-0.7.0 app/controllers/emailbutler/webhooks_controller.rb