Class: Truemail::Configuration
- Inherits:
-
Object
- Object
- Truemail::Configuration
- Defined in:
- lib/truemail/configuration.rb
Constant Summary collapse
- DEFAULT_CONNECTION_TIMEOUT =
2
- DEFAULT_RESPONSE_TIMEOUT =
2
- DEFAULT_CONNECTION_ATTEMPTS =
2
- DEFAULT_VALIDATION_TYPE =
:smtp
- DEFAULT_SMTP_PORT =
25
- DEFAULT_LOGGER_OPTIONS =
{ tracking_event: :error, stdout: false, log_absolute_path: nil }.freeze
- SETTERS =
%i[ email_pattern smtp_error_body_pattern connection_timeout response_timeout connection_attempts whitelisted_emails blacklisted_emails whitelisted_domains blacklisted_domains blacklisted_mx_ip_addresses dns smtp_port ].freeze
Instance Attribute Summary collapse
-
#not_rfc_mx_lookup_flow ⇒ Object
Returns the value of attribute not_rfc_mx_lookup_flow.
-
#smtp_fail_fast ⇒ Object
Returns the value of attribute smtp_fail_fast.
-
#smtp_safe_check ⇒ Object
Returns the value of attribute smtp_safe_check.
-
#whitelist_validation ⇒ Object
Returns the value of attribute whitelist_validation.
Instance Method Summary collapse
- #argument_consistent?(method, argument) ⇒ Boolean
- #complete? ⇒ Boolean
- #default_validation_type=(argument) ⇒ Object
-
#initialize(&block) ⇒ Configuration
constructor
A new instance of Configuration.
- #logger=(options) ⇒ Object
- #validation_type_for=(settings) ⇒ Object
- #verifier_domain=(domain) ⇒ Object
- #verifier_email=(email) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Configuration
Returns a new instance of Configuration.
39 40 41 42 43 44 |
# File 'lib/truemail/configuration.rb', line 39 def initialize(&block) instance_initializer.each do |instace_variable, value| instance_variable_set(:"@#{instace_variable}", value) end tap(&block) if block end |
Instance Attribute Details
#not_rfc_mx_lookup_flow ⇒ Object
Returns the value of attribute not_rfc_mx_lookup_flow.
37 38 39 |
# File 'lib/truemail/configuration.rb', line 37 def not_rfc_mx_lookup_flow @not_rfc_mx_lookup_flow end |
#smtp_fail_fast ⇒ Object
Returns the value of attribute smtp_fail_fast.
37 38 39 |
# File 'lib/truemail/configuration.rb', line 37 def smtp_fail_fast @smtp_fail_fast end |
#smtp_safe_check ⇒ Object
Returns the value of attribute smtp_safe_check.
37 38 39 |
# File 'lib/truemail/configuration.rb', line 37 def smtp_safe_check @smtp_safe_check end |
#whitelist_validation ⇒ Object
Returns the value of attribute whitelist_validation.
37 38 39 |
# File 'lib/truemail/configuration.rb', line 37 def whitelist_validation @whitelist_validation end |
Instance Method Details
#argument_consistent?(method, argument) ⇒ Boolean
67 68 69 70 71 72 73 |
# File 'lib/truemail/configuration.rb', line 67 def argument_consistent?(method, argument) case argument when ::Array then items_match_regex?(argument, regex_by_method(method)) when ::Integer then argument.positive? when ::Regexp then true end end |
#complete? ⇒ Boolean
87 88 89 |
# File 'lib/truemail/configuration.rb', line 87 def complete? !!verifier_email end |
#default_validation_type=(argument) ⇒ Object
57 58 59 60 |
# File 'lib/truemail/configuration.rb', line 57 def default_validation_type=(argument) raise_unless(argument, __method__, argument.is_a?(::Symbol) && Truemail::Validator::VALIDATION_TYPES.include?(argument)) @default_validation_type = argument end |
#logger=(options) ⇒ Object
82 83 84 85 |
# File 'lib/truemail/configuration.rb', line 82 def logger=() raise_unless(, __method__, .is_a?(::Hash)) @logger = Truemail::Logger::Builder.call(Truemail::Configuration::DEFAULT_LOGGER_OPTIONS, **) end |
#validation_type_for=(settings) ⇒ Object
62 63 64 65 |
# File 'lib/truemail/configuration.rb', line 62 def validation_type_for=(settings) validate_validation_type(settings) validation_type_by_domain.merge!(settings) end |
#verifier_domain=(domain) ⇒ Object
52 53 54 55 |
# File 'lib/truemail/configuration.rb', line 52 def verifier_domain=(domain) validate_arguments(domain, __method__) @verifier_domain = domain.downcase end |
#verifier_email=(email) ⇒ Object
46 47 48 49 50 |
# File 'lib/truemail/configuration.rb', line 46 def verifier_email=(email) validate_arguments(email, __method__) @verifier_email = email.downcase default_verifier_domain end |