Class: Truemail::Log::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/truemail/log/event.rb

Constant Summary collapse

TRACKING_EVENTS =
{
  all: %i[success unrecognized_error recognized_error],
  unrecognized_error: %i[unrecognized_error],
  recognized_error: %i[recognized_error],
  error: %i[unrecognized_error recognized_error]
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(event, validator_instance) ⇒ Event

Returns a new instance of Event.


14
15
16
17
18
19
20
# 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

Instance Method Details

#log_levelObject


26
27
28
# File 'lib/truemail/log/event.rb', line 26

def log_level
  action_level_log.last
end

#valid?Boolean

Returns:

  • (Boolean)

22
23
24
# File 'lib/truemail/log/event.rb', line 22

def valid?
  Truemail::Log::Event::TRACKING_EVENTS[event].include?(action_level_log.first)
end