phony 2.19.11 → 2.19.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d971b51de8e8d0581c884f90238d00bbdeeee7ca248ae3b93ce75e5b759114fd
4
- data.tar.gz: d37f03c8ca22a2fcf76b046a38cfd6cc6334d79cd377bb221e1610352b331ee7
3
+ metadata.gz: 45ec2d2d9ab9772ae3f05cd031cd6d4214f1a541838ac8539e5a8d60039d5119
4
+ data.tar.gz: 4998f527b3b6e2414ef7411c9736a39eaf4b9639faaca8d604a9802b1cf24d5b
5
5
  SHA512:
6
- metadata.gz: '028169288dfdcd908210a144add1c6d6eb082703602fd4eaa069c9ca952fe8e3e8c0c46764244af569cf90ba5fb535681369b700e3f273bebde591c534e544d3'
7
- data.tar.gz: dc281117fa228352a099b3dc28e77d13c7d8145ef93f50ab721817e6b0a6024a32e4f4587c191529142ba987498b62d9a1bd3b9c4cfbf3ae72f2537b70e375ab
6
+ metadata.gz: 8fc13c0c16a9dd41bc947308ca2e0c36d59f4efce442c9d21a105aeb919ce323e8190ee0e302cd184e7145b26d6f3b3c9c42009ed6905240c7884fba98b98918
7
+ data.tar.gz: 5cdc031002c1e727a852b67897d93e3c93c3aef931f1f9a563f62d0b37af9eb137a8e81b37648b57d05f1466e8bebcf0b175cba71215b4c97d7dc80fa78a5bdc
data/README.textile CHANGED
@@ -106,6 +106,10 @@ h2. List of Handled Countries
106
106
 
107
107
  Mildly unmaintained list: Abhas, Afghan, Algerian, Argentina, Austrian, Australian, Azerbaijani, Belgian, Brazilian, Cambodian, Chilean, Chinese, Croatian, Cuban, Cypriot, Czech, Danish, Dutch, Egyptian, El Salvadorian, Estonian, French, German, Ghanan, Gibraltar, Greek, Haiti, Hong Kong, Hungarian, Indian, Iran, Irish, Israel, Italian, Japanese, Kazakh, Liberian, Lithuanian, Luxembourgian, Malaysian, Malta, Mexican, Monaco, Morocco, New Zealand, Nigerian, Norwegian, Peruvian, Polish, Romanian, Russian, Rwandan, Seychelles, Singapore, Slovakian, South African, South Korean, South Osetian, Spanish, Sri Lankan, Sudan, Swedish, Swiss, Thailand, Tunisian, Turkish, Liechtenstein, UK, US, Venezuelan, Vietnamese, and Zambian numbers.
108
108
 
109
+ h2. Proud Sponsors
110
+
111
+ * Renuo AG (July 22 –): "Github":https://github.com/renuo, "Homepage":https://www.renuo.ch
112
+
109
113
  h2. License
110
114
 
111
115
  MIT.
@@ -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
- ndcs_2digit = [
8
+ ndcs_1digit = [
9
9
  '02', # Milan
10
10
  '06', # Rome (including State of Vatican City) and Aprilia
11
11
  ]
12
12
 
13
- ndcs_3digit = [
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
- ndcs_4digit = [
45
+ ndcs_3digit = [
46
46
  '0121', # Pinerolo
47
47
  '0122', # Sestrieres, Bardonecchia and other Susa Valley mountain resorts
48
48
  '0123', # Lanzo Torinese
@@ -269,21 +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(*ndcs_2digit) >> split(4, 2..4) |
276
- one_of(*ndcs_3digit) >> matched_split(
277
- /^1\d{6}$/ => [7],
278
- /^1\d{7}$/ => [8],
279
- /^[^1]\d{5}$/ => [6],
280
- /^[^1]\d{6}$/ => [7]
276
+ one_of(*ndcs_1digit) >> matched_split(
277
+ /\A\d{5}\z/ => [5],
278
+ /\A\d{6}\z/ => [4,2],
279
+ /\A\d{7}\z/ => [4,3],
280
+ /\A\d{8}\z/ => [4,4],
281
281
  ) |
282
- one_of(*ndcs_4digit) >> matched_split(
283
- /\A\d{4}\z/ => [4],
284
- /^1\d{5}$/ => [6],
285
- /^1\d{6}$/ => [7],
286
- /^[^1]\d{4}$/ => [5],
287
- /^[^1]\d{5}$/ => [3,3]
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]
288
+ ) |
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]
288
295
  )
289
296
  end
@@ -403,7 +403,56 @@ Phony.define do
403
403
  country '81',
404
404
  trunk('0', normalize: true, format: true, split: true) |
405
405
  one_of(%w(20 50 60 70 90)) >> split(4,4) | # mobile, VoIP telephony
406
+ match(/\A(597)9[0178]\d+\z/) >> split(2,4) |
406
407
  one_of(ndcs_with_5_subscriber_numbers) >> split(1,4) |
408
+ match(/\A(4)70[019]\d+\z/) >> split(4,4) |
409
+ match(/\A(4)71\d+\z/) >> split(4,4) |
410
+ match(/\A(4)20\d+\z/) >> split(4,4) |
411
+ match(/\A(4)29[02-69]\d+\z/) >> split(4,4) |
412
+ match(/\A(15)4[018]\d+\z/) >> split(3,4) |
413
+ match(/\A(22)3[014-9]\d+\z/) >> split(3,4) |
414
+ match(/\A(25)[04][01]\d+\z/) >> split(3,4) |
415
+ match(/\A(25)5[0-69]\d+\z/) >> split(3,4) |
416
+ match(/\A(25)[68][01]\d+\z/) >> split(3,4) |
417
+ match(/\A(25)7[015-9]\d+\z/) >> split(3,4) |
418
+ match(/\A(25)917\d+\z/) >> split(3,4) |
419
+ match(/\A(25)999\d+\z/) >> split(3,4) |
420
+ match(/\A(26)4[016-9]\d+\z/) >> split(3,4) |
421
+ match(/\A(28)3[0134]\d+\z/) >> split(3,4) |
422
+ match(/\A(28)9[0-5]\d+\z/) >> split(3,4) |
423
+ match(/\A(29)17\d+\z/) >> split(3,4) |
424
+ match(/\A(29)3[015-9]\d+\z/) >> split(3,4) |
425
+ match(/\A(42)21\d+\z/) >> split(3,4) |
426
+ match(/\A(42)8[01456]\d+\z/) >> split(3,4) |
427
+ match(/\A(47)5[019]\d+\z/) >> split(3,4) |
428
+ match(/\A(47)9[019]\d+\z/) >> split(3,4) |
429
+ match(/\A(59)8[019]\d+\z/) >> split(3,4) |
430
+ match(/\A(59)9[01]\d+\z/) >> split(3,4) |
431
+ match(/\A(79)4[0-59]\d+\z/) >> split(3,4) |
432
+ match(/\A(79)5[01569]\d+\z/) >> split(3,4) |
433
+ match(/\A(79)6[0167]\d+\z/) >> split(3,4) |
434
+ match(/\A(82)4[0-39]\d+\z/) >> split(3,4) |
435
+ match(/\A(82)9[019]\d+\z/) >> split(3,4) |
436
+ match(/\A(82)92[1-9]\d+\z/) >> split(3,4) |
437
+ match(/\A(82)94[1-3]\d+\z/) >> split(3,4) |
438
+ match(/\A(82)96[0-47-9]\d+\z/) >> split(3,4) |
439
+ match(/\A(82)965[01346-9]\d+\z/) >> split(3,4) |
440
+ match(/\A(82)966[1-9]\d+\z/) >> split(3,4) |
441
+ match(/\A(83)76[6-8]\d+\z/) >> split(3,4) |
442
+ match(/\A(83)7[01789]\d+\z/) >> split(3,4) |
443
+ match(/\A(83)8[01]\d+\z/) >> split(3,4) |
444
+ match(/\A(86)36[23]\d+\z/) >> split(3,4) |
445
+ match(/\A(86)5[0-389]\d+\z/) >> split(3,4) |
446
+ match(/\A(86)55[23]\d+\z/) >> split(3,4) |
447
+ match(/\A(86)[01]\d+\z/) >> split(3,4) |
448
+ match(/\A(86)9[178]\d+\z/) >> split(3,4) |
449
+ match(/\A(86)72\d+\z/) >> split(3,4) |
450
+ match(/\A(86)8[019]\d+\z/) >> split(3,4) |
451
+ match(/\A(86)9[0145]\d+\z/) >> split(3,4) |
452
+ match(/\A(86)99[014-9]\d+\z/) >> split(3,4) |
453
+ match(/\A(99)331\d+\z/) >> split(3,4) |
454
+ match(/\A(99)34[357]\d+\z/) >> split(3,4) |
455
+ match(/\A(99)4[0178]\d+\z/) >> split(3,4) |
407
456
  one_of(ndcs_with_6_subscriber_numbers) >> split(2,4) |
408
457
  one_of(%w(120)) >> split(3,3) | # freephone
409
458
  one_of(%w(800)) >> split(3,4) | # freephone
@@ -414,6 +463,6 @@ Phony.define do
414
463
  one_of(ndcs_with_8_subscriber_numbers) >> split(4,4) |
415
464
  # TODO: 91(NDC) N(S)N length: 5-13 - Non-geographic number (Direct subscriber telephone service (legacy))
416
465
  fixed(2) >> split(4,4),
417
- :local_space => :- ,
418
- :space => :-
466
+ local_space: :-,
467
+ space: :-
419
468
  end
@@ -232,6 +232,7 @@ Phony.define do
232
232
  # http://www.itu.int/oth/T020200002C/en
233
233
  country '57',
234
234
  match(/\A(3\d\d)\d+\z/) >> split(3,4) | # mobile (300 310 311 312 313 315 316)
235
+ match(/\A(60\d)\d+\z/) >> split(3,4) |
235
236
  fixed(1) >> split(3,4)
236
237
 
237
238
  # Venezuela (Bolivarian Republic of)
@@ -179,6 +179,14 @@ describe 'plausibility' do
179
179
  Phony.plausible?('+359 998 123456').should be_truthy
180
180
  Phony.plausible?('+359 999 123456').should be_truthy
181
181
  end
182
+ it_is_correct_for 'Colombia', :samples => ['+57 601 411 1899',
183
+ '+57 602 111 2222',
184
+ '+57 603 111 2222',
185
+ '+57 604 111 2222',
186
+ '+57 605 111 2222',
187
+ '+57 606 111 2222',
188
+ '+57 607 111 2222',
189
+ '+57 608 111 2222']
182
190
  it_is_correct_for 'Congo', :samples => '+242 1234 56789'
183
191
  it_is_correct_for 'Cook Islands', :samples => '+682 71928'
184
192
  it_is_correct_for 'Costa Rica', :samples => '+506 2 234 5678'
@@ -280,7 +288,6 @@ describe 'plausibility' do
280
288
  it_is_correct_for 'Guinea-Bissau', :samples => '+245 44 728 6998'
281
289
  it_is_correct_for 'Guyana', :samples => '+592 263 1234'
282
290
  it_is_correct_for 'Honduras (Republic of)', :samples => '+504 12 961 637'
283
- it_is_correct_for 'Italy', :samples => ['+39 0574 1234']
284
291
  it_is_correct_for 'Iraq', :samples => ['+964 1 123 4567',
285
292
  '+964 21 113 456',
286
293
  '+964 71 1234 5678']
@@ -601,6 +608,20 @@ describe 'plausibility' do
601
608
  Phony.plausible?('+62 22 0000 0000').should be_truthy
602
609
  Phony.plausible?('+62 22 000 000 000').should be_truthy
603
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
604
625
 
605
626
  it 'is correct for Russia' do
606
627
  Phony.plausible?('+7 3522 000 000').should be_truthy
@@ -240,7 +240,7 @@ describe 'country descriptions' do
240
240
  end
241
241
  end
242
242
  describe 'Colombia' do
243
- it_splits '5711234567', ['57', '1', '123', '4567']
243
+ it_splits '5711234567', ['57', '1', '123', '4567'] # Outdated.
244
244
  it_splits '573101234567', ['57', '310', '123', '4567'] # mobile
245
245
  end
246
246
  describe 'Croatia' do
@@ -460,8 +460,9 @@ describe 'country descriptions' do
460
460
  it_splits '3934869528123',['39', '348', '695', '2812', '3'] # Mobile (8-digit subscriber no - new)
461
461
  it_splits '393357210488', ['39', '335', '721', '0488'] # Mobile
462
462
  it_splits '393248644272', ['39', '324', '864', '4272'] # Mobile
463
- it_splits '3906123412', ['39', '06', '1234', '12'] # Roma 6 digit
464
- it_splits '39061234123', ['39', '06', '1234', '123'] # Roma 7 digit
463
+ it_splits '390612341', ['39', '06', '12341'] # Roma 5 digit
464
+ it_splits '3906123412', ['39', '06', '1234', '12'] # Roma 6 digit
465
+ it_splits '39061234123', ['39', '06', '1234', '123'] # Roma 7 digit
465
466
  it_splits '390612341234', ['39', '06', '1234', '1234'] # Roma 8 digit
466
467
  it_splits '3902888388', ['39', '02', '8883', '88'] # Milano 6 digit
467
468
  it_splits '39028883888', ['39', '02', '8883', '888'] # Milano 7 digit
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.11
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-04-21 00:00:00.000000000 Z
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
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  requirements: []
118
- rubygems_version: 3.1.6
118
+ rubygems_version: 3.0.3
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: Fast international phone number (E164 standard) normalizing, splitting and