truemail 1.9.1 → 1.9.2

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: 4132e99e612c8a1f9309dd9b81ef2ce5c234296209d631411687a4622c8581d2
4
- data.tar.gz: 360800f323194eaefa48592f4781ce232d9e205785b6eaea15fc22b8b6d28d24
3
+ metadata.gz: caf982d3dd889a337ae95ab4d4fa79157964e02d83656016ecead8d0831c4d46
4
+ data.tar.gz: 9b7ec050811c49072d18f7cd9e36229b982af742f24db3a031d4ab1e2e08f780
5
5
  SHA512:
6
- metadata.gz: 2786a16f5e4418cf704c1cc3eba5b4879072ed17e4a6a36180cb5994a8a824e7e492de4ec211c729783653e783538435f7b799b7f17d847d957511ba6a091687
7
- data.tar.gz: 4ecc2dcfd6377826852e64f59471aa2c70fe84be8739d1b20e73350beffc9b4e932b4fac62c48869850d8a28157aeb7756238964d3126e62026ff7f79a999edb
6
+ metadata.gz: d8991eb0d33e2aaff25fdbe9fc95b45e8ee6e0c2661b9c82e622eca182f22570b01f27848b60353bf1ce70419c94cbe23cd51871872e0f92f624676d8a0c317c
7
+ data.tar.gz: 7b8e1b24a90019bf21cb1534f64962ba8b68fe8fd6734a564d57c69fbf483c8e35a14bfd35317c58023f6f54616cad591439ac6eddef878604522d929dd6e42a
@@ -4,7 +4,7 @@
4
4
 
5
5
  - [ ] I have updated truemail to the latest version
6
6
  - [ ] I have read the [Contribution Guidelines](https://github.com/rubygarage/truemail/blob/master/CONTRIBUTING.md)
7
- - [ ] I have read the [documentation](https://github.com/rubygarage/truemail/blob/master/README.md)
7
+ - [ ] I have read the [documentation](https://truemail-rb.org/truemail-gem)
8
8
  - [ ] I have searched for [existing GitHub issues](https://github.com/rubygarage/truemail/issues)
9
9
 
10
10
  ### Issue Description
@@ -2,6 +2,18 @@
2
2
 
3
3
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4
4
 
5
+ ## [1.9.2] - 2020.10.02
6
+
7
+ ### Added
8
+
9
+ - `Truemail::TypeError`
10
+ - error handling for invalid types as input email
11
+
12
+ ### Changed
13
+
14
+ - Updated `Truemail.validate`
15
+ - Updated `Truemail.valid?`
16
+
5
17
  ## [1.9.1] - 2020.09.21
6
18
 
7
19
  ### Changed
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- truemail (1.9.1)
4
+ truemail (1.9.2)
5
5
  simpleidn (~> 0.1.1)
6
6
 
7
7
  GEM
@@ -5,6 +5,7 @@ require_relative 'truemail/core'
5
5
  module Truemail
6
6
  INCOMPLETE_CONFIG = 'verifier_email is required parameter'
7
7
  NOT_CONFIGURED = 'use Truemail.configure before or pass custom configuration'
8
+ INVALID_TYPE = 'email should be a String'
8
9
 
9
10
  class << self
10
11
  def configuration(&block)
@@ -25,10 +26,12 @@ module Truemail
25
26
  end
26
27
 
27
28
  def validate(email, custom_configuration: nil, **options)
29
+ check_argument_type(email)
28
30
  Truemail::Validator.new(email, configuration: determine_configuration(custom_configuration), **options).run
29
31
  end
30
32
 
31
33
  def valid?(email, **options)
34
+ check_argument_type(email)
32
35
  validate(email, **options).result.valid?
33
36
  end
34
37
 
@@ -38,8 +41,12 @@ module Truemail
38
41
 
39
42
  private
40
43
 
41
- def raise_unless(condition, message)
42
- raise Truemail::ConfigurationError, message unless condition
44
+ def raise_unless(condition, message, error_class = Truemail::ConfigurationError)
45
+ raise error_class, message unless condition
46
+ end
47
+
48
+ def check_argument_type(argument)
49
+ raise_unless(argument.is_a?(String), Truemail::INVALID_TYPE, Truemail::TypeError)
43
50
  end
44
51
 
45
52
  def determine_configuration(custom_configuration)
@@ -11,6 +11,7 @@ module Truemail
11
11
  require_relative '../truemail/logger'
12
12
 
13
13
  ConfigurationError = Class.new(StandardError)
14
+ TypeError = Class.new(StandardError)
14
15
 
15
16
  ArgumentError = Class.new(StandardError) do
16
17
  def initialize(arg_value, arg_name)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Truemail
4
- VERSION = '1.9.1'
4
+ VERSION = '1.9.2'
5
5
  end
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: 1.9.1
4
+ version: 1.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladislav Trotsenko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-21 00:00:00.000000000 Z
11
+ date: 2020-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simpleidn