phony 2.16.9 → 2.16.10
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/japan.rb +2 -1
- data/lib/phony/countries/russia_kazakhstan_abkhasia_south_ossetia.rb +20 -13
- data/lib/phony/countries/ukraine.rb +1 -0
- data/lib/phony/countries/vietnam.rb +8 -2
- data/lib/phony/country_codes.rb +1 -1
- data/spec/functional/plausibility_spec.rb +11 -2
- data/spec/lib/phony/countries_spec.rb +3 -1
- 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: 7f43e15c89c7a3584c6306f5db30348a8af3b9fae66fac55672d446515902ec6
|
4
|
+
data.tar.gz: 807035a30b1b445ff66f764178dd7d1a2bb5054ae57a525860aedf11c138dd5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95ae5fa19472f69c75c4151fb1ce21112c3e8b2b82bfd466e3bcbecb7a0ec2aefaa8c8b6743b05bd059086138ae00f4c4c46baa094c7b972eb84a4bc08c4673f
|
7
|
+
data.tar.gz: f270781a365518eda490f6e50534868d352594d81d47fa31771d4f26d4f773baea3bd37b08c1e123244843cc2e273116c92c45578005093e9aa51f1191b65d75
|
@@ -405,7 +405,8 @@ Phony.define do
|
|
405
405
|
one_of('20', '50', '60', '70', '90') >> split(4,4) | # mobile, VoIP telephony
|
406
406
|
one_of(ndcs_with_5_subscriber_numbers) >> split(1,4) |
|
407
407
|
one_of(ndcs_with_6_subscriber_numbers) >> split(2,4) |
|
408
|
-
one_of(%w(120
|
408
|
+
one_of(%w(120)) >> split(3,3) | # freephone
|
409
|
+
one_of(%w(120 800)) >> split(3,4) | # freephone
|
409
410
|
one_of(ndcs_with_7_subscriber_numbers) >> split(3,4) |
|
410
411
|
one_of(ndcs_with_8_subscriber_numbers) >> split(4,4) |
|
411
412
|
# TODO: 91(NDC) N(S)N length: 5-13 - Non-geographic number (Direct subscriber telephone service (legacy))
|
@@ -1,14 +1,15 @@
|
|
1
1
|
ndcs_with_5_subscriber_digits = %w(30130 30131 30132 30133 30134 30135 30136 30137 30138 30140 30141 30142 30143 30144
|
2
2
|
30145 30146 30147 30148 30149 30150 30153 30230 30231 30232 30233 30234 30235 30236 30237 30238 30239 30240 30241
|
3
3
|
30242 30243 30244 30245 30246 30247 30248 30249 30251 30252 30253 30255 30256 30257 30261 30262 30264 30265 30266
|
4
|
+
33622
|
4
5
|
34126 34130 34132 34133 34134 34136 34138 34139 34141 34145 34147 34150 34151 34152 34153 34154 34155 34157 34158
|
5
|
-
34159 34161 34162 34163 34164 34166 34240 34241
|
6
|
+
34159 34161 34162 34163 34164 34166 34240 34241 34243 34244 34245 34246 34248 34249 34250 34251 34252 34253
|
6
7
|
34254 34255 34256 34257 34258 34259 34260 34261 34262 34263 34265 34266 34268 34269 34271 34272 34273 34274 34275
|
7
8
|
34276 34277 34278 34279 34291 34292 34293 34294 34296 34297 34298 34341 34342 34343 34344 34345 34346 34347 34349
|
8
9
|
34350 34355 34356 34357 34358 34360 34361 34362 34363 34364 34365 34367 34368 34369 34370 34371 34372 34373 34374
|
9
10
|
34375 34376 34377 34380 34383 34384 34385 34386 34387 34388 34389 34391 34394 34395 34397 34398 34531 34533 34535
|
10
11
|
34537 34539 34541 34542 34543 34544 34545 34546 34547 34550 34551 34553 34554 34555 34556 34557 34561 34634 34638
|
11
|
-
34643 34667 34668 34669 34670 34672
|
12
|
+
34643 34667 34668 34669 34670 34672 34674 34675 34676 34677 34678 34731 34739 34740 34741 34742 34743 34744
|
12
13
|
34745 34746 34747 34748 34749 34750 34751 34752 34753 34754 34755 34756 34757 34758 34759 34760 34761 34762 34763
|
13
14
|
34764 34765 34766 34767 34768 34769 34770 34771 34772 34773 34774 34775 34776 34777 34778 34779 34780 34781 34782
|
14
15
|
34783 34784 34785 34786 34787 34788 34789 34791 34792 34794 34795 34796 34797 34798 34922 34932 34934 34936 34938
|
@@ -61,7 +62,9 @@ ndcs_with_5_subscriber_digits = %w(30130 30131 30132 30133 30134 30135 30136 301
|
|
61
62
|
49146 49147 49148 49151 49152 49153 49154 49155 49156 49157 49158 49231 49232 49233 49234 49235 49236 49237 49238
|
62
63
|
49241 49242 49243 49244 49245 49246 49247 49248 49254 49331 49333 49334 49336 49337 49339 49341 49343 49344 49345
|
63
64
|
49346 49347 49349 49351 49352 49353 49354 49355 49356 49357 49430 49431 49432 49433 49434 49435 49436 49437 49438
|
64
|
-
49439 49440 49441 49442 49443 49444 49445 49446 49447 49448 49449 49450 49451 49452 49453
|
65
|
+
49439 49440 49441 49442 49443 49444 49445 49446 49447 49448 49449 49450 49451 49452 49453 71036 71063 71133 71237
|
66
|
+
71336 71337 71431 71433 71435 71536 71538 71543 71630 71636 71644 71645 71651 71837 72137 72153 72251 72335 72336
|
67
|
+
72340 72433 72533 72537 72636 72752 72771 72772 72774 72775 72834 72835 81131 81132 81133 81134
|
65
68
|
81135 81136 81137 81138 81139 81140 81141 81142 81143 81144 81145 81146 81147 81148 81149 81150 81151 81152 81153
|
66
69
|
81361 81362 81363 81364 81365 81366 81367 81368 81369 81370 81371 81372 81373 81374 81375 81376 81378 81379 81430
|
67
70
|
81431 81433 81434 81436 81437 81439 81450 81451 81452 81454 81455 81456 81457 81458 81459 81530 81531 81532 81533
|
@@ -85,7 +88,7 @@ ndcs_with_5_subscriber_digits = %w(30130 30131 30132 30133 30134 30135 30136 301
|
|
85
88
|
84377 84378 84379 84396 84442 84443 84444 84445 84446 84447 84452 84453 84454 84455 84456 84457 84458 84461 84462
|
86
89
|
84463 84464 84465 84466 84467 84468 84472 84473 84474 84475 84476 84477 84478 84479 84492 84493 84494 84495 84540
|
87
90
|
84542 84543 84544 84545 84548 84549 84550 84551 84552 84554 84555 84557 84558 84560 84561 84562 84563 84564 84565
|
88
|
-
84566 84567 84568 84573 84574 84575 84576 84577 84578 84579 84591 84592 84593 84595 84596
|
91
|
+
84566 84567 84568 84573 84574 84575 84576 84577 84578 84579 84591 84592 84593 84595 84596 84635 84639 84646
|
89
92
|
84647 84648 84650 84651 84652 84653 84654 84655 84656 84657 84658 84660 84661 84663 84664 84666 84667 84670 84671
|
90
93
|
84672 84673 84674 84675 84676 84677 84722 84731 84732 84733 84734 84735 84736 84741 84742 84743 84744 84745 84746
|
91
94
|
84747 84862 85140 85141 85142 85143 85144 85145 85146 85147 85148 85149 85171 85172 85549 85551 85552 85555 85556
|
@@ -103,17 +106,21 @@ ndcs_with_5_subscriber_digits = %w(30130 30131 30132 30133 30134 30135 30136 301
|
|
103
106
|
87872 87873 87874 87875 87876 87877 87878 87879 87922 87932 87934 87935 87937 87938 87951 87961 87964
|
104
107
|
)
|
105
108
|
|
106
|
-
ndcs_with_6_subscriber_digits = %w(3012 3022 3412 3435 3439 3452 3456 3462 3463 3466 3473 3494 3496 3513 3519
|
107
|
-
3812 3822 3823 3842 3843 3846 3852 3854 3882 3902 3919 3942 3952 3953 3955 4012 4112 4132 4152 4162
|
108
|
-
4236 4242 4712 4722 4725 4742 4752 4812 4822 4832 4842 4852 4855 4862 4872 4912 4922 4932 4942
|
109
|
-
|
110
|
-
|
109
|
+
ndcs_with_6_subscriber_digits = %w(3012 3022 3412 3424 3435 3439 3452 3456 3462 3463 3466 3467 3473 3494 3496 3513 3519
|
110
|
+
3522 3532 3537 3812 3822 3823 3842 3843 3846 3852 3854 3882 3902 3919 3942 3952 3953 3955 4012 4112 4132 4152 4162
|
111
|
+
4212 4217 4234 4236 4242 4712 4722 4725 4742 4752 4812 4822 4832 4842 4852 4855 4862 4872 4912 4922 4932 4942
|
112
|
+
7102 7112 7122 7132 7142 7152 7162 7172 7182 7187 7212 7213 7222 7232 7242 7252 7262 7272 7282 7292 8112 8142 8152
|
113
|
+
8162 8172 8202 8212 8216 8313 8332 8342 8352 8362 8412 8422 8442 8443 8452 8453 8464 8482 8512 8552 8553 8555 8557
|
114
|
+
8617 8622 8634 8635 8636 8639 8652 8662 8672 8712 8722 8732 8772 8782 8793
|
111
115
|
)
|
112
116
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
+
# 978, 869, and 365 are mobile, Sevastopol landlines, and Crimean landlines,
|
118
|
+
# which I can't wait to have removed from this library ASAP due to the illegal
|
119
|
+
# annexation of Ukrainian territory.
|
120
|
+
ndcs_with_7_subscriber_digits = %w(342 343 347 351 365 383 391 423 473 495 496 498 499 700 701 702 727 777 778 804 812
|
121
|
+
818 831 843 844 846 861 863 869 900 901 902 903 904 905 906 908 909 910 911 912 913 914 915 916 917 918 919 920 921
|
122
|
+
922 923 924 925 926 927 928 929 930 931 932 933 934 936 937 938 950 951 952 953 958 960 961 962 963 964 965 966 967
|
123
|
+
968 969 977 978 980 981 982 983 984 985 986 987 988 989 992 993 995 996 997 999
|
117
124
|
)
|
118
125
|
|
119
126
|
Phony.define do
|
@@ -40,7 +40,6 @@ ndcs_with_7_subscriber_digits = [
|
|
40
40
|
'237', # Thanh Hóa Province
|
41
41
|
'238', # Nghệ An Province
|
42
42
|
'239', # Hà Tĩnh Province
|
43
|
-
'24', # Hà Nội Province
|
44
43
|
'251', # Đồng Nai Province
|
45
44
|
'252', # Bình Thuận Province
|
46
45
|
'254', # Bà Rịa Vũng Tàu Province
|
@@ -62,7 +61,6 @@ ndcs_with_7_subscriber_digits = [
|
|
62
61
|
'275', # Bến Tre Province
|
63
62
|
'276', # Tây Ninh Province
|
64
63
|
'277', # Đồng Tháp Province
|
65
|
-
'28', # Hồ Chí Minh Province
|
66
64
|
'290', # Cà Mau Province
|
67
65
|
'291', # Bạc Liêu Province
|
68
66
|
'292', # Cần Thơ Province
|
@@ -73,6 +71,13 @@ ndcs_with_7_subscriber_digits = [
|
|
73
71
|
'299', # Sóc Trăng Province
|
74
72
|
]
|
75
73
|
|
74
|
+
ndcs_with_8_subscriber_digits = [
|
75
|
+
'4', # Hà Nội Province
|
76
|
+
'24', # Hà Nội Province
|
77
|
+
'28', # Hồ Chí Minh Province
|
78
|
+
'8', # Hồ Chí Minh Province
|
79
|
+
]
|
80
|
+
|
76
81
|
mobile = [
|
77
82
|
'32', # Viettel Mobile
|
78
83
|
'33', # Viettel Mobile
|
@@ -117,6 +122,7 @@ Phony.define do
|
|
117
122
|
trunk('0') |
|
118
123
|
one_of(mobile) >> split(4..8)|
|
119
124
|
one_of(ndcs_with_7_subscriber_digits) >> split(3,4) |
|
125
|
+
one_of(ndcs_with_8_subscriber_digits) >> split(4,4) |
|
120
126
|
one_of(mobile_with_trunk) >> split(5..8)|
|
121
127
|
# Govt reserved
|
122
128
|
fixed(80) >> split(5) |
|
data/lib/phony/country_codes.rb
CHANGED
@@ -537,6 +537,9 @@ describe 'plausibility' do
|
|
537
537
|
'+598 93 123 456',
|
538
538
|
'+598 908 123 45',
|
539
539
|
'+598 805 123 45']
|
540
|
+
it_is_correct_for 'Vietnam', :samples => ['+84 24 41234567',
|
541
|
+
'+84 28 41234567',
|
542
|
+
'+84 23 61234567']
|
540
543
|
it_is_correct_for 'Yemen', :samples => [['+967 1 234 567', '+967 1 234 5678'],
|
541
544
|
'+967 7 234 567',
|
542
545
|
'+967 77 123 4567',
|
@@ -570,12 +573,12 @@ describe 'plausibility' do
|
|
570
573
|
Phony.plausible?('+51 9 1234 1234').should be_truthy # mobile
|
571
574
|
Phony.plausible?('+51 84 123 123').should be_truthy # Cuzco, best effort
|
572
575
|
end
|
573
|
-
|
576
|
+
|
574
577
|
it 'is correct for Kosovo' do
|
575
578
|
Phony.plausible?('+383 29 000 000').should be_truthy # Landline
|
576
579
|
Phony.plausible?('+383 44 000 000').should be_truthy # Mobile
|
577
580
|
end
|
578
|
-
|
581
|
+
|
579
582
|
it 'is correct for Bulgaria' do
|
580
583
|
Phony.plausible?('+359 2 123 123').should be_truthy # Landline Sofia
|
581
584
|
Phony.plausible?('+359 2 123 1234').should be_truthy # Landline Sofia
|
@@ -587,6 +590,12 @@ describe 'plausibility' do
|
|
587
590
|
it 'is correct for Malaysia' do
|
588
591
|
Phony.plausible?('+60 5 123 1234').should be_truthy # Non Selangor Landline
|
589
592
|
end
|
593
|
+
|
594
|
+
it 'is correct for Japan' do
|
595
|
+
Phony.plausible?('+81 90 1234 1234').should be_truthy
|
596
|
+
Phony.plausible?('+81 120 123 123').should be_truthy
|
597
|
+
Phony.plausible?('+81 800 123 1234').should be_truthy
|
598
|
+
end
|
590
599
|
end
|
591
600
|
end
|
592
601
|
end
|
@@ -446,6 +446,7 @@ describe 'country descriptions' do
|
|
446
446
|
describe 'Japan' do
|
447
447
|
it_splits '81312345678', %w(81 3 1234 5678) # Tokyo
|
448
448
|
it_splits '81612345678', %w(81 6 1234 5678) # Osaka
|
449
|
+
it_splits '818001001234', %w(81 800 100 1234) # Freephone
|
449
450
|
it_splits '81120123456', %w(81 120 123 456) # Freephone
|
450
451
|
it_splits '81111234567', %w(81 11 123 4567)
|
451
452
|
it_splits '81123123456', %w(81 123 12 3456)
|
@@ -811,7 +812,8 @@ describe 'country descriptions' do
|
|
811
812
|
describe 'Vietnam' do
|
812
813
|
it_splits '8498123456', ['84', '98', '123456'] # Viettel Mobile
|
813
814
|
it_splits '8499612345', ['84', '99', '612345'] # GTel
|
814
|
-
it_splits '
|
815
|
+
it_splits '842421234567', ['84', '24', '2123', '4567'] # Hanoi
|
816
|
+
it_splits '842841234567', ['84', '28', '4123', '4567'] # Ho Chi Minh City
|
815
817
|
it_splits '84341234567', ['84', '34', '1234567'] # Viettel
|
816
818
|
it_splits '84841234567', ['84', '84', '1234567'] # Vinaphone
|
817
819
|
end
|
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.16.
|
4
|
+
version: 2.16.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:
|
11
|
+
date: 2019-02-03 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
|