Sha256: ec2bb0b1ff93980afcdbbf7baa2da4e2592b877b5de57ac83441e363ab4b0642

Contents?: true

Size: 537 Bytes

Versions: 5

Compression:

Stored size: 537 Bytes

Contents

# frozen_string_literal: true

module Mailtrap
  module ActionMailer
    class DeliveryMethod
      attr_accessor :settings

      ALLOWED_PARAMS = %i[api_key api_host api_port bulk sandbox inbox_id].freeze

      def initialize(settings)
        self.settings = settings
      end

      def deliver!(message)
        mail = Mailtrap::Mail.from_message(message)

        client.send(mail)
      end

      private

      def client
        @client ||= Mailtrap::Client.new(**settings.slice(*ALLOWED_PARAMS))
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mailtrap-2.2.0 lib/mailtrap/action_mailer/delivery_method.rb
mailtrap-2.1.2 lib/mailtrap/action_mailer/delivery_method.rb
mailtrap-2.1.1 lib/mailtrap/action_mailer/delivery_method.rb
mailtrap-2.1.0 lib/mailtrap/action_mailer/delivery_method.rb
mailtrap-2.0.0 lib/mailtrap/action_mailer/delivery_method.rb