Sha256: fc5d1c2fe31a66a94a3353e7d0d344c5a9de3526cddfd120a8eeaf4d72acde21

Contents?: true

Size: 541 Bytes

Versions: 3

Compression:

Stored size: 541 Bytes

Contents

# frozen_string_literal: true

module Emailbutler
  class WebhooksController < Emailbutler::ApplicationController
    skip_before_action :verify_authenticity_token

    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.6 app/controllers/emailbutler/webhooks_controller.rb
emailbutler-0.7.5 app/controllers/emailbutler/webhooks_controller.rb
emailbutler-0.7.4 app/controllers/emailbutler/webhooks_controller.rb