class Truemail::Log::Event

Constants

TRACKING_EVENTS

Attributes

event[R]
has_validation_errors[R]
successful_validation[R]
validation_smtp_debug[R]

Public Class Methods

new(event, validator_instance) click to toggle source
# File lib/truemail/log/event.rb, line 14
def initialize(event, validator_instance)
  validator_result = validator_instance.result
  @event = event
  @has_validation_errors = !validator_result.errors.empty?
  @successful_validation = validator_result.success
  @validation_smtp_debug = validator_result.smtp_debug
end

Public Instance Methods

log_level() click to toggle source
# File lib/truemail/log/event.rb, line 26
def log_level
  action_level_log.last
end
valid?() click to toggle source
# File lib/truemail/log/event.rb, line 22
def valid?
  Truemail::Log::Event::TRACKING_EVENTS[event].include?(action_level_log.first)
end

Private Instance Methods

action_level_log() click to toggle source
# File lib/truemail/log/event.rb, line 34
def action_level_log
  @action_level_log ||=
    case
    when successful_validation && !validation_smtp_debug then [:success, ::Logger::INFO]
    when successful_validation && validation_smtp_debug  then [:unrecognized_error, ::Logger::WARN]
    when !successful_validation && has_validation_errors then [:recognized_error, ::Logger::ERROR]
    end
end