Sha256: 69f85de17f60184297f31df150a7554c3653464a4d60dd34ef5c3bcbf868760f

Contents?: true

Size: 1.2 KB

Versions: 8

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

module Truemail
  module Log
    module Serializer
      class ValidatorBase < Truemail::Log::Serializer::Base
        def initialize(executor_instance)
          @validation_type = executor_instance.validation_type
          super
        end

        private

        attr_reader :validation_type

        def smtp_debug
          validation_smtp_debug = executor_result.smtp_debug
          return unless validation_smtp_debug
          validation_smtp_debug.map do |smtp_request|
            smtp_response = smtp_request.response
            {
              mail_host: smtp_request.host,
              port_opened: smtp_response.port_opened,
              connection: smtp_response.connection,
              errors: smtp_response.errors
            }
          end
        end

        def result
          @result ||=
            {
              date: Time.now,
              email: executor_result.email,
              validation_type: validation_type,
              success: executor_result.success,
              errors: errors(executor_result.errors),
              smtp_debug: smtp_debug,
              configuration: configuration
            }
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
truemail-2.2.0 lib/truemail/log/serializer/validator_base.rb
truemail-2.1.0 lib/truemail/log/serializer/validator_base.rb
truemail-2.0.2 lib/truemail/log/serializer/validator_base.rb
truemail-2.0.1 lib/truemail/log/serializer/validator_base.rb
truemail-2.0.0 lib/truemail/log/serializer/validator_base.rb
truemail-1.9.2 lib/truemail/log/serializer/validator_base.rb
truemail-1.9.1 lib/truemail/log/serializer/validator_base.rb
truemail-1.9.0 lib/truemail/log/serializer/validator_base.rb