phony 2.20.10 → 2.20.12
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/phony/countries/vietnam.rb +3 -0
- data/lib/phony/countries.rb +6 -6
- data/spec/functional/plausibility_spec.rb +6 -4
- data/spec/lib/phony/countries_spec.rb +4 -0
- 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: b309483112eea98930ed42b246d6df922d06e268212e696aa23c28035956f65c
|
4
|
+
data.tar.gz: 1ee4fbc7968e7bbc3d90ac062635c2cc810d9aa3890103aeeb03fd13dbddedc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76d9ad6a66e4df3eecdd12338ac140f3f93eb8fde71975c01035373f1f4074a9590d32251f50ef0207949f23561cc9b72ae83b1d3960148c23cb3156c9c172ad
|
7
|
+
data.tar.gz: a4e5c31d362c9afbca54e4fd7248569b008d405ea4b2ea52891f3f4b84cc01514f982e79a80a619886cb57f5c142c55de9342f8c1af4a7df1f9893ea1182dfd7
|
@@ -127,6 +127,9 @@ Phony.define do
|
|
127
127
|
one_of(ndcs_with_7_subscriber_digits) >> split(3,4) |
|
128
128
|
one_of(ndcs_with_8_subscriber_digits) >> split(4,4) |
|
129
129
|
one_of(mobile_with_trunk) >> split(5..8)|
|
130
|
+
one_of('1900') >> matched_split(
|
131
|
+
/\A\d{4}\z/ => [4],
|
132
|
+
/\A\d{6}\z/ => [6]) | # Premium rate
|
130
133
|
# Govt reserved
|
131
134
|
fixed(80) >> split(5) |
|
132
135
|
fixed(69) >> split(1,5)
|
data/lib/phony/countries.rb
CHANGED
@@ -654,12 +654,12 @@ Phony.define do
|
|
654
654
|
match(/^(2[467]\d{2})\d{4}$/) >> split(2,2) | # 4-digit NDC
|
655
655
|
match(/^(6\d[18])\d+$/) >> split(3,3) | # mobile
|
656
656
|
match(/^(60\d{2})\d{8}$/) >> split(2,2,2,2) | # mobile machine to machine
|
657
|
-
match(/^((2[^467]|[
|
658
|
-
match(/^((2[^467]|[
|
659
|
-
match(/^((2[^467]|[
|
660
|
-
match(/^((2[^467]|[
|
661
|
-
match(/^((2[^467]|[
|
662
|
-
match(/^((2[^467]|[
|
657
|
+
match(/^((2[^467]|[2-9]\d))\d{4}$/) >> split(2,2) | # 2-digit NDC Regular 6 digits number
|
658
|
+
match(/^((2[^467]|[2-9]\d))\d{4}$/) >> split(2,2) | # 2-digit NDC Regular 6 digits number
|
659
|
+
match(/^((2[^467]|[2-9]\d))\d{5}$/) >> split(2,2,1) | # 2-digit NDC Regular 6 digits number w/ 1 digit extension
|
660
|
+
match(/^((2[^467]|[2-9]\d))\d{6}$/) >> split(2,2,2) | # 2-digit NDC Regular 8 digits number or 6 digits with 2 digits extension
|
661
|
+
match(/^((2[^467]|[2-9]\d))\d{7}$/) >> split(2,2,3) | # 2-digit NDC Regular 6 digits with 4 digits extension
|
662
|
+
match(/^((2[^467]|[2-9]\d))\d{8}$/) >> split(2,2,4) | # 2-digit NDC Regular 6 digits number with 4 digits extension
|
663
663
|
match(/^(\d{2})\d{3}$/) >> split(2,2,1) # fallback for 5 digit number
|
664
664
|
|
665
665
|
# country '353' # Republic of Ireland, see special file.
|
@@ -590,7 +590,9 @@ describe 'plausibility' do
|
|
590
590
|
'+598 805 123 45']
|
591
591
|
it_is_correct_for 'Vietnam', :samples => ['+84 24 41234567',
|
592
592
|
'+84 28 41234567',
|
593
|
-
'+84 23 61234567'
|
593
|
+
'+84 23 61234567',
|
594
|
+
'+84 1900 1212',
|
595
|
+
'+84 1900 541234']
|
594
596
|
it_is_correct_for 'Yemen', :samples => [['+967 1 234 567', '+967 1 234 5678'],
|
595
597
|
'+967 7 234 567',
|
596
598
|
'+967 77 123 4567',
|
@@ -617,16 +619,16 @@ describe 'plausibility' do
|
|
617
619
|
Phony.plausible?('+62 22 0000 0000').should be_truthy
|
618
620
|
Phony.plausible?('+62 22 000 000 000').should be_truthy
|
619
621
|
end
|
620
|
-
|
622
|
+
|
621
623
|
it 'is correct for Italy' do
|
622
624
|
Phony.plausible?('+39 0574 123').should be_falsy
|
623
625
|
Phony.plausible?('+39 0574 1234').should be_truthy
|
624
626
|
Phony.plausible?('+39 0574 12345').should be_falsy
|
625
|
-
|
627
|
+
|
626
628
|
Phony.plausible?('+39 085 541').should be_falsy
|
627
629
|
Phony.plausible?('+39 085 5410').should be_truthy
|
628
630
|
Phony.plausible?('+39 085 54105').should be_truthy
|
629
|
-
|
631
|
+
|
630
632
|
Phony.plausible?('+39 06 4991').should be_falsy
|
631
633
|
Phony.plausible?('+39 06 49911').should be_truthy
|
632
634
|
Phony.plausible?('+39 06 499112').should be_truthy
|
@@ -528,6 +528,8 @@ describe 'country descriptions' do
|
|
528
528
|
it_splits '352545258', ['352', '54', '52', '58']
|
529
529
|
it_splits '352818181', ['352', '81', '81', '81']
|
530
530
|
it_splits '3523572141', ['352', '35', '72', '14', '1']
|
531
|
+
it_splits '3522634731', ['352', '26', '34', '73', '1']
|
532
|
+
it_splits '352264412701', ['352', '26', '44', '12', '701']
|
531
533
|
end
|
532
534
|
describe 'Macedonia' do
|
533
535
|
it_splits '38921234567', ['389', '2', '123', '4567'] # Skopje
|
@@ -855,6 +857,8 @@ describe 'country descriptions' do
|
|
855
857
|
it_splits '842841234567', ['84', '28', '4123', '4567'] # Ho Chi Minh City
|
856
858
|
it_splits '84341234567', ['84', '34', '1234567'] # Viettel
|
857
859
|
it_splits '84841234567', ['84', '84', '1234567'] # Vinaphone
|
860
|
+
it_splits '8419001212', ['84', '1900', '1212'] # Vinaphone
|
861
|
+
it_splits '841900541234', ['84', '1900', '541234'] # Vinaphone
|
858
862
|
end
|
859
863
|
describe 'Zambia' do
|
860
864
|
it_splits '260211123456', ['260', '211', '123456'] # Fixed
|
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.20.
|
4
|
+
version: 2.20.12
|
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: 2024-01-22 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
|