Class: Truemail::Validator
- Defined in:
- lib/truemail/validator.rb
Defined Under Namespace
Classes: Result
Constant Summary collapse
- RESULT_ATTRS =
%i[success email domain mail_servers errors smtp_debug configuration].freeze
- VALIDATION_TYPES =
%i[regex mx mx_blacklist smtp].freeze
Instance Attribute Summary collapse
-
#validation_type ⇒ Object
readonly
Returns the value of attribute validation_type.
Attributes inherited from Executor
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(email, configuration:, with: nil) ⇒ Validator
constructor
A new instance of Validator.
- #run ⇒ Object
Constructor Details
#initialize(email, configuration:, with: nil) ⇒ Validator
Returns a new instance of Validator.
21 22 23 24 25 26 |
# File 'lib/truemail/validator.rb', line 21 def initialize(email, configuration:, with: nil) with ||= configuration.default_validation_type raise Truemail::ArgumentError.new(with, :argument) unless Truemail::Validator::VALIDATION_TYPES.include?(with) @result = Truemail::Validator::Result.new(email: email, configuration: configuration) @validation_type = select_validation_type(email, with) end |
Instance Attribute Details
#validation_type ⇒ Object (readonly)
Returns the value of attribute validation_type.
19 20 21 |
# File 'lib/truemail/validator.rb', line 19 def validation_type @validation_type end |
Instance Method Details
#as_json ⇒ Object
35 36 37 |
# File 'lib/truemail/validator.rb', line 35 def as_json Truemail::Log::Serializer::ValidatorJson.call(self) end |