truemail 3.1.2 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de638476d58e55bc0aa2befde555d82c52a38dcbe8813018424ef88332bfb784
4
- data.tar.gz: 303aa7f0951cd60ebdc8278a1e2d8a5a09ab3af21c5ad26166817926a71c0855
3
+ metadata.gz: eaf56f1be4d147276a83807c713461d7bc2d4bedb009a0323fa3a38b7fd82829
4
+ data.tar.gz: cb914e607e6a0182d7550a0fa0d8de7783c79763809019d4e706a6207daabc39
5
5
  SHA512:
6
- metadata.gz: b750c9066195850e05136d79bc67c7e86fb84bdafb7cf3a52ff41f07fa49af3d2006efd858b6a4c90e3b092c4c895e6188ae0f0dbeebb39a16747e4ff35b6367
7
- data.tar.gz: d7277714943f8c6c9a9d370170b4adb4c3e75917837e93eba9580aa4213f837aaf6a7d6beddb7b84555de3387bb0f049a8634ff18b0747240d6dd030d47a1300
6
+ metadata.gz: c2fdf6d58ca54b4c2a25eea14e6769277b16cfc24b32709d0195ef0fa29ac13d71c19717f0f8d4f5626e7c9348815307f7fa7d0238f0feeb5076fd6314fd00e6
7
+ data.tar.gz: 0a3b9b4ec3fa36fd3a73353d651d5e9af664d5ebd030ab72a3942a24b9e7d1590dddaf569a3b3b83c36a3c83926fef1fb0c3c1fbdab19f7e7de7d1e5827d5ba4
@@ -2,12 +2,19 @@
2
2
 
3
3
  module Truemail
4
4
  class Configuration
5
+ require 'logger'
6
+
5
7
  DEFAULT_CONNECTION_TIMEOUT = 2
6
8
  DEFAULT_RESPONSE_TIMEOUT = 2
7
9
  DEFAULT_CONNECTION_ATTEMPTS = 2
8
10
  DEFAULT_VALIDATION_TYPE = :smtp
9
11
  DEFAULT_SMTP_PORT = 25
10
- DEFAULT_LOGGER_OPTIONS = { tracking_event: :error, stdout: false, log_absolute_path: nil }.freeze
12
+ DEFAULT_LOGGER_OPTIONS = {
13
+ logger_class: ::Logger,
14
+ tracking_event: :error,
15
+ stdout: false,
16
+ log_absolute_path: nil
17
+ }.freeze
11
18
  SETTERS = %i[
12
19
  email_pattern
13
20
  smtp_error_body_pattern
@@ -75,15 +82,17 @@ module Truemail
75
82
  end
76
83
  end
77
84
 
78
- def logger=(options)
79
- tracking_event, stdout, log_absolute_path = logger_options(options)
85
+ def logger=(options) # rubocop:disable Metrics/AbcSize
86
+ raise_unless(options, __method__, options.is_a?(::Hash))
87
+ logger_class, tracking_event, stdout, log_absolute_path = logger_options(options)
88
+ raise_unless(logger_class, __method__, logger_class.is_a?(::Class))
80
89
  valid_event = Truemail::Log::Event::TRACKING_EVENTS.key?(tracking_event)
81
90
  stdout_only = stdout && log_absolute_path.nil?
82
91
  file_only = log_absolute_path.is_a?(::String)
83
92
  both_types = stdout && file_only
84
93
  argument_info = valid_event ? log_absolute_path : tracking_event
85
94
  raise_unless(argument_info, __method__, valid_event && (stdout_only || file_only || both_types))
86
- @logger = Truemail::Logger.new(tracking_event, stdout, log_absolute_path)
95
+ @logger = Truemail::Logger.new(logger_class, tracking_event, stdout, log_absolute_path)
87
96
  end
88
97
 
89
98
  def complete?
@@ -2,11 +2,10 @@
2
2
 
3
3
  module Truemail
4
4
  class Logger
5
- require 'logger'
5
+ attr_reader :logger_class, :event, :stdout, :file
6
6
 
7
- attr_reader :event, :stdout, :file
8
-
9
- def initialize(event, error_stdout, log_absolute_path)
7
+ def initialize(logger_class, event, error_stdout, log_absolute_path)
8
+ @logger_class = logger_class
10
9
  @event = event
11
10
  @stdout = error_stdout
12
11
  @file = log_absolute_path
@@ -30,7 +29,7 @@ module Truemail
30
29
  def create_logs(log_level, serialized_object)
31
30
  %i[stdout file].each do |output_type|
32
31
  next unless public_send(output_type)
33
- ::Logger.new(output_type.eql?(:stdout) ? $stdout : init_log_file).add(log_level) { serialized_object }
32
+ logger_class.new(output_type.eql?(:stdout) ? $stdout : init_log_file).add(log_level) { serialized_object }
34
33
  end
35
34
  end
36
35
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Truemail
4
- VERSION = '3.1.2'
4
+ VERSION = '3.2.0'
5
5
  end
data/truemail.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ['Vladislav Trotsenko']
9
9
  spec.email = %w[admin@bestweb.com.ua]
10
10
 
11
- spec.summary = %(truemail)
11
+ spec.summary = %(Configurable framework agnostic plain Ruby email validator. Verify email via Regex, DNS, SMTP and even more)
12
12
  spec.description = %(Configurable framework agnostic plain Ruby email validator. Verify email via Regex, DNS, SMTP and even more.)
13
13
 
14
14
  spec.homepage = 'https://github.com/truemail-rb/truemail'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: truemail
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.2
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladislav Trotsenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-15 00:00:00.000000000 Z
11
+ date: 2024-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simpleidn
@@ -219,5 +219,6 @@ requirements: []
219
219
  rubygems_version: 3.2.15
220
220
  signing_key:
221
221
  specification_version: 4
222
- summary: truemail
222
+ summary: Configurable framework agnostic plain Ruby email validator. Verify email
223
+ via Regex, DNS, SMTP and even more
223
224
  test_files: []