phony 2.19.7 → 2.19.10

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: f544b11a7d8e0f28ee13fc67d92fb3cd5a98f968ccfce3cb60b7781bc761fba5
4
- data.tar.gz: cec200536113d42a5c6822c7d8e636b925a8c48ee062fc5ef99143548eb7cc13
3
+ metadata.gz: d8e8c59adf885678317d72197e37fc237635f43e83bdc49b3162dc0226142185
4
+ data.tar.gz: fae6cff7e1fb009729a6098c69b76dd95f51596cac3c6ac1006562bd8759cdfd
5
5
  SHA512:
6
- metadata.gz: b4e9ac3559aa37f477e87e453c1316d12636fbedac8d9ae9f0e66e9af378009265abdf93882a159bfe6f42af2235e68a5cb55ec116593d2714de40b45c2c0d31
7
- data.tar.gz: ed1fd348d0d1951c4de48ed8d7fca4f10c35f91d2a08b223d5fa14cbbf144c1d96a4d30e2c45af230760ad4733bbd9c053aded4f1c1052ed7ef618e6ef67dfab
6
+ metadata.gz: c75466301cd92d29728be0570c9c300697fa0c7c1ea00143420af3f4b5c2e6bd10d9e39bbe4327946be6703bef773ad36df9328fdb7bb8838647726352d6b0af
7
+ data.tar.gz: 38ffb42f3b733f312b83b9d37d7e5f678836fd4be25b611f73d6465198491508ba14352a77687f3db4507ba44de3ef61a8cd2d1fc30b94df2946587b42c4e5bd
@@ -280,6 +280,7 @@ Phony.define do
280
280
  /^[^1]\d{6}$/ => [7]
281
281
  ) |
282
282
  one_of(*ndcs_4digit) >> matched_split(
283
+ /\A\d{4}\z/ => [4],
283
284
  /^1\d{5}$/ => [6],
284
285
  /^1\d{6}$/ => [7],
285
286
  /^[^1]\d{4}$/ => [5],
@@ -111,6 +111,6 @@ Phony.define do
111
111
  one_of(ndcs_with_5_subscriber_numbers) >> split(3,2) |
112
112
  one_of(ndcs_with_6_subscriber_numbers) >> split(3,3) |
113
113
  one_of(ndcs_with_7_subscriber_numbers) >> split(4,3) |
114
- one_of(%w(91 92)) >> split(4,3) | # mobile
114
+ one_of(%w(91 92 94 95)) >> split(4,3) | # mobile
115
115
  fixed(2) >> split(3,3)
116
116
  end
@@ -96,15 +96,16 @@ Phony.define do
96
96
  # Belgium.
97
97
  #
98
98
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Belgium
99
+ # https://www.bipt.be/operators/publication/national-numbering-plan
99
100
  #
100
101
  country '32', trunk('0') |
101
- match(/^(7[08])\d+$/) >> split(3,3) | # Premium and national rate Services
102
- match(/^(800|90\d)\d+$/) >> split(2,3) | # Toll free service and premium numbers
103
- match(/^(46[05678])\d{6}$/) >> split(2,2,2) | # Mobile (Lycamobile, Telenet, Join Experience, Proximus 0460)
104
- match(/^(4[789]\d)\d{6}$/) >> split(2,2,2) | # Mobile
105
- match(/^(45[56])\d{6}$/) >> split(2,2,2) | # Mobile Vikings and Voo
106
- one_of('2','3','4','9') >> split(3,2,2) | # Short NDCs
107
- fixed(2) >> split(2,2,2) # 2-digit NDCs
102
+ match(/^(7[08])\d+$/) >> split(3,3) | # Premium and national rate Services
103
+ match(/^(800|90\d)\d+$/) >> split(2,3) | # Toll free service and premium numbers
104
+ match(/^(46[056789])\d{6}$/) >> split(2,2,2) | # Mobile (Lycamobile, Telenet, Join Experience, Proximus 0460)
105
+ match(/^(4[789]\d)\d{6}$/) >> split(2,2,2) | # Mobile
106
+ match(/^(45[56])\d{6}$/) >> split(2,2,2) | # Mobile Vikings and Voo
107
+ one_of('2','3','4','9') >> split(3,2,2) | # Short NDCs
108
+ fixed(2) >> split(2,2,2) # 2-digit NDCs
108
109
 
109
110
  # France.
110
111
  #
@@ -493,22 +494,24 @@ Phony.define do
493
494
  match(/^(800)/) >> split(3,3) | # Toll free
494
495
  match(/^(21[1-8])/) >> split(6) # Fixed
495
496
 
496
- # Madagascar http://www.wtng.info/wtng-261-mg.html
497
+ # Madagascar
498
+ # https://en.wikipedia.org/wiki/Telephone_numbers_in_Madagascar
497
499
  # http://www.itu.int/oth/T020200007F/en
498
500
  country '261',
499
- none >> matched_split(
500
- /\A200\d+\z/ => [2,3,3,3], # Telecom Malagasy (Telma)
501
- /\A20\d+\z/ => [2,3,4], # Telecom Malagasy (Telma)
502
- /\A23\d+\z/ => [2,3,4], # Digitel
503
- /\A30\d+\z/ => [2,3,4], # mobile Madamobil (CDMA2000)
504
- /\A31\d+\z/ => [2,3,4], # mobile Airtel Madagascar
505
- /\A32\d+\z/ => [2,3,4], # mobile Orange Madagascar
506
- /\A33\d+\z/ => [2,3,4], # mobile Airtel Madagascar
507
- /\A34\d+\z/ => [2,3,4], # mobile Telecom Malagasy (Telma)
508
- /\A5\d+\z/ => [3,3,3], # pager
509
- /\A22\d+\z/ => [3,3,3], # satellite GULFSAT Téléphonie
510
- /\A6\d+\z/ => [3,3,3] # satellite
511
- )
501
+ # none >> matched_split(
502
+ # /\A20\d+\z/ => [2,2,3,2], # Telecom Malagasy (Telma)
503
+ # /\A32\d+\z/ => [2,2,3,2], # mobile Orange Madagascar
504
+ # /\A33\d+\z/ => [2,2,3,2], # mobile Airtel Madagascar
505
+ # /\A34\d+\z/ => [2,2,3,2], # mobile Telecom Malagasy (Telma)
506
+ # /\A38\d+\z/ => [2,2,3,2], # mobile Telecom Malagasy (Telma)
507
+ # /\A39\d+\z => [2,2,3,2] # mobile Blueline
508
+ # ),
509
+ match(/\A(20)\d+\z/) >> split(2,3,2) | # fix Telecom Malagasy (Telma)
510
+ match(/\A(32)\d+\z/) >> split(2,3,2) | # mobile Orange Madagascar
511
+ match(/\A(33)\d+\z/) >> split(2,3,2) | # mobile Airtel Madagascar
512
+ match(/\A(34)\d+\z/) >> split(2,3,2) | # mobile Telecom Malagasy (Telma)
513
+ match(/\A(38)\d+\z/) >> split(2,3,2) | # mobile Telecom Malagasy (Telma)
514
+ match(/\A(39)\d+\z/) >> split(2,3,2) # mobile Blueline Madagascar
512
515
 
513
516
  country '262', # Reunion / Mayotte (new) http://www.wtng.info/wtng-262-fr.html
514
517
  trunk('0') |
@@ -280,6 +280,7 @@ describe 'plausibility' do
280
280
  it_is_correct_for 'Guinea-Bissau', :samples => '+245 44 728 6998'
281
281
  it_is_correct_for 'Guyana', :samples => '+592 263 1234'
282
282
  it_is_correct_for 'Honduras (Republic of)', :samples => '+504 12 961 637'
283
+ it_is_correct_for 'Italy', :samples => ['+39 0574 1234']
283
284
  it_is_correct_for 'Iraq', :samples => ['+964 1 123 4567',
284
285
  '+964 21 113 456',
285
286
  '+964 71 1234 5678']
@@ -324,10 +325,19 @@ describe 'plausibility' do
324
325
  it_is_correct_for 'Macedonia', :samples => ['+389 2 123 4567',
325
326
  '+389 7 124 3456',
326
327
  '+389 7 234 5678']
327
- it_is_correct_for 'Madagascar', :samples => ['+261 20 012 345 678',
328
- '+261 20 124 3456',
329
- '+261 512 345 678',
330
- '+261 33 345 6789']
328
+ it_is_correct_for 'Madagascar', :samples => ['+261 20 23 456 78',
329
+ '+261 32 34 546 78',
330
+ '+261 33 34 546 78',
331
+ '+261 34 34 546 78',
332
+ '+261 38 34 546 78']
333
+ it 'is incorrect for Madagascar' do
334
+ Phony.plausible?('+261 20 012 345 678').should be_falsey
335
+ Phony.plausible?('+261 20 12 434 569').should be_falsey
336
+ Phony.plausible?('+261 51 23 4567 8').should be_falsey
337
+ Phony.plausible?('+261 34 345 46789').should be_falsey
338
+ Phony.plausible?('+261 34 345 467').should be_falsey
339
+ end
340
+
331
341
  it_is_correct_for 'Malawi', :samples => ['+265 1725 123',
332
342
  '+265 213 456 789',
333
343
  '+265 9123 456',
@@ -507,7 +517,10 @@ describe 'plausibility' do
507
517
  it_is_correct_for 'Lybia', :samples => ['+218 205 123 45',
508
518
  '+218 22 123 456',
509
519
  '+218 21 1234 456',
510
- '+218 91 1234 456']
520
+ '+218 91 1234 456',
521
+ '+218 92 1234 456',
522
+ '+218 94 1234 456',
523
+ '+218 95 1234 456']
511
524
  it_is_correct_for 'Mongolia', :samples => ['+976 11 123 45',
512
525
  ['+976 121 12 34', '+976 121 12 345'],
513
526
  '+976 70 123 456',
@@ -110,6 +110,7 @@ describe 'country descriptions' do
110
110
  it_splits '32466123456', ['32', '466', '12', '34', '56'] # mobile (Vectone)
111
111
  it_splits '32467123456', ['32', '467', '12', '34', '56'] # mobile (Telenet)
112
112
  it_splits '32468123456', ['32', '468', '12', '34', '56'] # mobile (Telenet)
113
+ it_splits '32469123456', ['32', '469', '12', '34', '56'] # mobile ()
113
114
  it_splits '32475123456', ['32', '475', '12', '34', '56'] # mobile (Proximus)
114
115
  it_splits '32485123456', ['32', '485', '12', '34', '56'] # mobile (Telenet)
115
116
  it_splits '32495123456', ['32', '495', '12', '34', '56'] # mobile (Orange)
@@ -469,6 +470,7 @@ describe 'country descriptions' do
469
470
  it_splits '3903123391', ['39', '031', '23391'] # Como
470
471
  it_splits '390909709511', ['39', '090', '9709511'] # Barcellona
471
472
  it_splits '390471811353', ['39', '0471', '811', '353'] # Bolzano
473
+ it_splits '3905745730', ['39', '0574', '5730'] # Prato
472
474
  end
473
475
  describe 'Japan' do
474
476
  it_splits '81312345678', %w(81 3 1234 5678) # Tokyo
@@ -1051,11 +1053,14 @@ describe 'country descriptions' do
1051
1053
  it_splits '21822123456', %w(218 22 123 456)
1052
1054
  it_splits '218211234456', %w(218 21 1234 456)
1053
1055
  it_splits '218911234456', %w(218 91 1234 456)
1056
+ it_splits '218941234456', %w(218 94 1234 456)
1057
+ it_splits '218951234456', %w(218 95 1234 456)
1054
1058
  end
1055
1059
  describe 'Madagascar' do
1056
- it_splits '26120012345678', ['261', false, '20', '012', '345', '678']
1057
- it_splits '261201243456', ['261', false, *%w(20 124 3456)]
1058
- it_splits '261512345678', ['261', false, *%w(512 345 678)]
1060
+ it_splits '261202254716', ['261', '20', *%w(22 547 16)]
1061
+ it_splits '261320254716', ['261', '32', *%w(02 547 16)]
1062
+ it_splits '261330254716', ['261', '33', *%w(02 547 16)]
1063
+ it_splits '261340254716', ['261', '34', *%w(02 547 16)]
1059
1064
  end
1060
1065
  describe 'Malawi' do
1061
1066
  it_splits '2651725123', ['265', false, '1725', '123']
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.7
4
+ version: 2.19.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Hanke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-16 00:00:00.000000000 Z
11
+ date: 2022-03-30 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