Sha256: 21377514d02b91007f0614b594500c422d9cb2d3c5fbafedf6633ea727ed720b

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

require 'dry/container'
require 'emailbutler/webhooks/mappers/sendgrid'
require 'emailbutler/webhooks/mappers/smtp2go'
require 'emailbutler/webhooks/mappers/resend'
require 'emailbutler/webhooks/mappers/mailjet'
require 'emailbutler/webhooks/mappers/mailtrap'
require 'emailbutler/webhooks/mappers/mandrill'
require 'emailbutler/webhooks/receiver'

module Emailbutler
  class Container
    extend Dry::Container::Mixin

    DEFAULT_OPTIONS = { memoize: true }.freeze

    class << self
      def register(key)
        super(key, DEFAULT_OPTIONS)
      end
    end

    # webhook mappers
    register(:sendgrid_mapper) { Emailbutler::Webhooks::Mappers::Sendgrid.new }
    register(:smtp2go_mapper) { Emailbutler::Webhooks::Mappers::Smtp2Go.new }
    register(:resend_mapper) { Emailbutler::Webhooks::Mappers::Resend.new }
    register(:mailjet_mapper) { Emailbutler::Webhooks::Mappers::Mailjet.new }
    register(:mailtrap_mapper) { Emailbutler::Webhooks::Mappers::Mailtrap.new }
    register(:mandrill_mapper) { Emailbutler::Webhooks::Mappers::Mandrill.new }

    # webhook receiver
    register(:webhooks_receiver) { Emailbutler::Webhooks::Receiver.new }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
emailbutler-0.8.8 lib/emailbutler/container.rb
emailbutler-0.8.7 lib/emailbutler/container.rb
emailbutler-0.8.6 lib/emailbutler/container.rb
emailbutler-0.8.5 lib/emailbutler/container.rb