telephone_number 1.4.4 → 1.4.5
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 +4 -4
- data/lib/importers/test_data_importer.rb +1 -1
- data/lib/telephone_number/parser.rb +10 -5
- data/lib/telephone_number/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e1f48528c24b8209a7249897915221fe199dfb44
|
|
4
|
+
data.tar.gz: 14d0f77b933e58e22543faf85d1d9f45026e86af
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '049b869cea68f8c7d1a81d15c7fa6598e8c8b0e423c5ee269e1a975e259489d09c87a9da63629f231f52fe2718b7cb111e551cda456c8fd60346b80337cdc3d8'
|
|
7
|
+
data.tar.gz: c034eba54a5a8596a725e8a38b41ff995ea15451a1c5df3fd44b1bceb68867fac20a11ab424983ab435289ddb93613f680813c669c97051a6480ed18b3650a06
|
|
@@ -11,7 +11,7 @@ module TelephoneNumber
|
|
|
11
11
|
AU: %w(0467703037),
|
|
12
12
|
BE: %w(32498485960 32477702206 32474095692),
|
|
13
13
|
BO: %w(59178500348 59178006138 59178006139),
|
|
14
|
-
BR: %w(011992339376 1123456789 11961234567),
|
|
14
|
+
BR: %w(011992339376 1123456789 11961234567 55991472683),
|
|
15
15
|
BY: %w(80152450911 294911911 152450911),
|
|
16
16
|
CA: %w(16135550119 16135550171 16135550112 16135550194
|
|
17
17
|
16135550122 16135550131 15146708700 14169158200),
|
|
@@ -9,7 +9,7 @@ module TelephoneNumber
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def valid_types
|
|
12
|
-
@valid_types ||=
|
|
12
|
+
@valid_types ||= generate_valid_types(normalized_number)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def valid?(keys = [])
|
|
@@ -23,15 +23,20 @@ module TelephoneNumber
|
|
|
23
23
|
# basically anything else that uses google data
|
|
24
24
|
def build_normalized_number
|
|
25
25
|
match_result = parse_prefix.match(country.full_general_pattern)
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
if match_result && generate_valid_types(match_result[:national_num]).any?
|
|
28
|
+
match_result[:national_num]
|
|
29
|
+
else
|
|
30
|
+
original_number
|
|
31
|
+
end
|
|
27
32
|
end
|
|
28
33
|
|
|
29
|
-
# returns an array of valid types for the
|
|
34
|
+
# returns an array of valid types for the given number
|
|
30
35
|
# if array is empty, we can assume that the number is invalid
|
|
31
|
-
def
|
|
36
|
+
def generate_valid_types(number)
|
|
32
37
|
return [] unless country
|
|
33
38
|
country.validations.select do |validation|
|
|
34
|
-
|
|
39
|
+
number.match?(Regexp.new("^(#{validation.pattern})$"))
|
|
35
40
|
end.map(&:name)
|
|
36
41
|
end
|
|
37
42
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: telephone_number
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.4.
|
|
4
|
+
version: 1.4.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- MOBI Wireless Management
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-12-
|
|
11
|
+
date: 2019-12-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|