phony 2.19.14 → 2.19.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phony/countries/italy.rb +18 -16
- data/spec/functional/plausibility_spec.rb +14 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45ec2d2d9ab9772ae3f05cd031cd6d4214f1a541838ac8539e5a8d60039d5119
|
4
|
+
data.tar.gz: 4998f527b3b6e2414ef7411c9736a39eaf4b9639faaca8d604a9802b1cf24d5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fc13c0c16a9dd41bc947308ca2e0c36d59f4efce442c9d21a105aeb919ce323e8190ee0e302cd184e7145b26d6f3b3c9c42009ed6905240c7884fba98b98918
|
7
|
+
data.tar.gz: 5cdc031002c1e727a852b67897d93e3c93c3aef931f1f9a563f62d0b37af9eb137a8e81b37648b57d05f1466e8bebcf0b175cba71215b4c97d7dc80fa78a5bdc
|
@@ -3,14 +3,14 @@
|
|
3
3
|
# Italian phone numbers.
|
4
4
|
#
|
5
5
|
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Italy
|
6
|
-
#
|
6
|
+
# https://www.itu.int/dms_pub/itu-t/oth/02/02/T020200006B0001PDFE.pdf
|
7
7
|
|
8
|
-
|
8
|
+
ndcs_1digit = [
|
9
9
|
'02', # Milan
|
10
10
|
'06', # Rome (including State of Vatican City) and Aprilia
|
11
11
|
]
|
12
12
|
|
13
|
-
|
13
|
+
ndcs_2digit = [
|
14
14
|
'010', # Genoa
|
15
15
|
'011', # Turin
|
16
16
|
'015', # Biella
|
@@ -42,7 +42,7 @@ ndcs_3digit = [
|
|
42
42
|
'099', # Taranto
|
43
43
|
]
|
44
44
|
|
45
|
-
|
45
|
+
ndcs_3digit = [
|
46
46
|
'0121', # Pinerolo
|
47
47
|
'0122', # Sestrieres, Bardonecchia and other Susa Valley mountain resorts
|
48
48
|
'0123', # Lanzo Torinese
|
@@ -269,26 +269,28 @@ service = [ # Not exhaustive.
|
|
269
269
|
]
|
270
270
|
|
271
271
|
Phony.define do
|
272
|
+
# Note: The 0 does not count towards NDC number length.
|
272
273
|
country '39', trunk('', normalize: false) |
|
273
274
|
one_of(*service) >> split(3,3) |
|
274
275
|
one_of(*mobile) >> split(3,4,-1..1) |
|
275
|
-
one_of(*
|
276
|
+
one_of(*ndcs_1digit) >> matched_split(
|
276
277
|
/\A\d{5}\z/ => [5],
|
277
278
|
/\A\d{6}\z/ => [4,2],
|
278
279
|
/\A\d{7}\z/ => [4,3],
|
279
280
|
/\A\d{8}\z/ => [4,4],
|
280
281
|
) |
|
281
|
-
one_of(*
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
282
|
+
one_of(*ndcs_2digit) >> matched_split(
|
283
|
+
/\A\d{4}\z/ => [4],
|
284
|
+
/\A\d{5}\z/ => [5],
|
285
|
+
/\A\d{6}\z/ => [6],
|
286
|
+
/\A\d{7}\z/ => [7],
|
287
|
+
/\A\d{8}\z/ => [8]
|
286
288
|
) |
|
287
|
-
one_of(*
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
289
|
+
one_of(*ndcs_3digit) >> matched_split(
|
290
|
+
/\A\d{4}\z/ => [4],
|
291
|
+
/\A1\d{5}\z/ => [6],
|
292
|
+
/\A1\d{6}\z/ => [7],
|
293
|
+
/\A[^1]\d{4}\z/ => [5],
|
294
|
+
/\A[^1]\d{5}\z/ => [3,3]
|
293
295
|
)
|
294
296
|
end
|
@@ -288,8 +288,6 @@ describe 'plausibility' do
|
|
288
288
|
it_is_correct_for 'Guinea-Bissau', :samples => '+245 44 728 6998'
|
289
289
|
it_is_correct_for 'Guyana', :samples => '+592 263 1234'
|
290
290
|
it_is_correct_for 'Honduras (Republic of)', :samples => '+504 12 961 637'
|
291
|
-
it_is_correct_for 'Italy', :samples => ['+39 0574 1234',
|
292
|
-
'+39 06 49911']
|
293
291
|
it_is_correct_for 'Iraq', :samples => ['+964 1 123 4567',
|
294
292
|
'+964 21 113 456',
|
295
293
|
'+964 71 1234 5678']
|
@@ -610,6 +608,20 @@ describe 'plausibility' do
|
|
610
608
|
Phony.plausible?('+62 22 0000 0000').should be_truthy
|
611
609
|
Phony.plausible?('+62 22 000 000 000').should be_truthy
|
612
610
|
end
|
611
|
+
|
612
|
+
it 'is correct for Italy' do
|
613
|
+
Phony.plausible?('+39 0574 123').should be_falsy
|
614
|
+
Phony.plausible?('+39 0574 1234').should be_truthy
|
615
|
+
Phony.plausible?('+39 0574 12345').should be_falsy
|
616
|
+
|
617
|
+
Phony.plausible?('+39 085 541').should be_falsy
|
618
|
+
Phony.plausible?('+39 085 5410').should be_truthy
|
619
|
+
Phony.plausible?('+39 085 54105').should be_truthy
|
620
|
+
|
621
|
+
Phony.plausible?('+39 06 4991').should be_falsy
|
622
|
+
Phony.plausible?('+39 06 49911').should be_truthy
|
623
|
+
Phony.plausible?('+39 06 499112').should be_truthy
|
624
|
+
end
|
613
625
|
|
614
626
|
it 'is correct for Russia' do
|
615
627
|
Phony.plausible?('+7 3522 000 000').should be_truthy
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.19.
|
4
|
+
version: 2.19.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Hanke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'Fast international phone number (E164 standard) normalizing, splitting
|
14
14
|
and formatting. Lots of formatting options: International (+.., 00..), national
|