phony 2.16.4 → 2.16.5
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.rb +21 -5
- data/spec/functional/plausibility_spec.rb +19 -0
- data/spec/lib/phony/countries_spec.rb +6 -2
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 007664f345320ce791321f4caefa7547e51fc87f
|
4
|
+
data.tar.gz: 88fa29994d4278c8a103b60286a920fb582582e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 106d1d49a6bd3c4a2448e18c4bba3f8896c3a6cb46cf9597a0c9b0a8ff7c061cd877bd9b5189bedb68a193714e64c322b8658cf1345a6c563b323c334a4f2a76
|
7
|
+
data.tar.gz: 3e23392df6d3f950664b15f3d3be277627d3b2f9242e8033d97a41c73e1d0b3d6d03e56e37e75bf922658e7dd578fd88209bff681b2dde76716284f5ede146dd
|
data/lib/phony/countries.rb
CHANGED
@@ -184,11 +184,13 @@ Phony.define do
|
|
184
184
|
# country '49' # Germany, see special file.
|
185
185
|
|
186
186
|
# Peru.
|
187
|
-
#
|
187
|
+
# Note: https://en.wikipedia.org/wiki/Telephone_numbers_in_Peru
|
188
|
+
# Note: https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=PE
|
188
189
|
country '51',
|
189
190
|
one_of('103', '105') >> split(3,3) | # Service.
|
190
|
-
one_of('
|
191
|
-
|
191
|
+
one_of('9') >> split(4,4) | # Mobile.
|
192
|
+
one_of('1') >> split(3,4) | # Lima.
|
193
|
+
fixed(2) >> split(3,3) # 2-digit NDCs.
|
192
194
|
|
193
195
|
# Mexico.
|
194
196
|
#
|
@@ -679,9 +681,17 @@ Phony.define do
|
|
679
681
|
|
680
682
|
# Bulgaria
|
681
683
|
#
|
684
|
+
# Note: https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=BG
|
685
|
+
# Note: https://en.wikipedia.org/wiki/Telephone_numbers_in_Bulgaria
|
682
686
|
country '359',
|
683
687
|
trunk('0') |
|
684
|
-
|
688
|
+
one_of('2') >> matched_split(
|
689
|
+
/\A\d{6}\z/ => [3,3], # Landline Sofia (optional last digit)
|
690
|
+
/\A\d{7}\z/ => [3,4]) | # Landline Sofia
|
691
|
+
fixed(2) >> matched_split(
|
692
|
+
/\A\d{5}\z/ => [3,2], # Landline (optional last digit)
|
693
|
+
/\A\d{6}\z/ => [3,3], # Landline
|
694
|
+
/\A\d{7}\z/ => [3,4]) # Mobile
|
685
695
|
|
686
696
|
# Lithuania
|
687
697
|
#
|
@@ -733,7 +743,13 @@ Phony.define do
|
|
733
743
|
|
734
744
|
# country '382' # Montenegro, see special file
|
735
745
|
|
736
|
-
|
746
|
+
# Kosovo
|
747
|
+
#
|
748
|
+
# Note: https://en.wikipedia.org/wiki/Telephone_numbers_in_Kosovo
|
749
|
+
country '383',
|
750
|
+
trunk('0') |
|
751
|
+
fixed(2) >> split(3,3)
|
752
|
+
|
737
753
|
country '384', todo # -
|
738
754
|
|
739
755
|
# country '385' # Croatia, see special file.
|
@@ -411,6 +411,25 @@ describe 'plausibility' do
|
|
411
411
|
it 'is correct for Russia' do
|
412
412
|
Phony.plausible?('+7 3522 000 000').should be_truthy
|
413
413
|
end
|
414
|
+
|
415
|
+
it 'is correct for Peru' do
|
416
|
+
Phony.plausible?('+51 1 123 1234').should be_truthy # Lima
|
417
|
+
Phony.plausible?('+51 9 1234 1234').should be_truthy # mobile
|
418
|
+
Phony.plausible?('+51 84 123 123').should be_truthy # Cuzco, best effort
|
419
|
+
end
|
420
|
+
|
421
|
+
it 'is correct for Kosovo' do
|
422
|
+
Phony.plausible?('+383 29 000 000').should be_truthy # Landline
|
423
|
+
Phony.plausible?('+383 44 000 000').should be_truthy # Mobile
|
424
|
+
end
|
425
|
+
|
426
|
+
it 'is correct for Bulgaria' do
|
427
|
+
Phony.plausible?('+359 2 123 123').should be_truthy # Landline Sofia
|
428
|
+
Phony.plausible?('+359 2 123 1234').should be_truthy # Landline Sofia
|
429
|
+
Phony.plausible?('+359 30 123 12').should be_truthy # Landline
|
430
|
+
Phony.plausible?('+359 30 123 123').should be_truthy # Landline
|
431
|
+
Phony.plausible?('+359 89 123 1234').should be_truthy # Mobile
|
432
|
+
end
|
414
433
|
end
|
415
434
|
end
|
416
435
|
end
|
@@ -442,6 +442,10 @@ describe 'country descriptions' do
|
|
442
442
|
it_splits '254111234567', ['254', '11', '1234567'] # Mombasa
|
443
443
|
it_splits '254723100220', ['254', '723', '100220'] # Mombasa
|
444
444
|
end
|
445
|
+
describe 'Kosovo' do
|
446
|
+
it_splits '38329000000', ['383', '29', '000', '000'] # Landline
|
447
|
+
it_splits '38344000000', ['383', '44', '000', '000'] # Mobile
|
448
|
+
end
|
445
449
|
describe 'Kyrgyzstan' do
|
446
450
|
it_splits '996312212345', %w(996 312 212 345)
|
447
451
|
it_splits '996315212345', %w(996 315 212 345)
|
@@ -563,9 +567,9 @@ describe 'country descriptions' do
|
|
563
567
|
it_splits '595961611234', %w(595 96 161 1234)
|
564
568
|
end
|
565
569
|
describe 'Peru' do
|
566
|
-
it_splits '
|
570
|
+
it_splits '5111231234', ['51', '1', '123', '1234'] # Lima
|
567
571
|
it_splits '51912341234', ['51', '9', '1234', '1234'] # mobile
|
568
|
-
it_splits '
|
572
|
+
it_splits '5184123123', ['51', '84', '123', '123'] # Cuzco, best effort
|
569
573
|
end
|
570
574
|
describe 'Philippines' do
|
571
575
|
it_splits '6321234567', ['63', '2', '1234567']
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Hanke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-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
|
@@ -118,18 +118,18 @@ specification_version: 4
|
|
118
118
|
summary: Fast international phone number (E164 standard) normalizing, splitting and
|
119
119
|
formatting.
|
120
120
|
test_files:
|
121
|
-
- spec/
|
122
|
-
- spec/lib/phony/countries_spec.rb
|
123
|
-
- spec/lib/phony/country_codes_spec.rb
|
121
|
+
- spec/lib/phony_spec.rb
|
124
122
|
- spec/lib/phony/country_spec.rb
|
125
|
-
- spec/lib/phony/dsl_spec.rb
|
126
|
-
- spec/lib/phony/local_splitters/fixed_spec.rb
|
127
|
-
- spec/lib/phony/local_splitters/regex_spec.rb
|
128
123
|
- spec/lib/phony/national_code_spec.rb
|
129
|
-
- spec/lib/phony/
|
130
|
-
- spec/lib/phony/
|
124
|
+
- spec/lib/phony/countries_spec.rb
|
125
|
+
- spec/lib/phony/dsl_spec.rb
|
126
|
+
- spec/lib/phony/national_splitters/variable_spec.rb
|
131
127
|
- spec/lib/phony/national_splitters/none_spec.rb
|
132
128
|
- spec/lib/phony/national_splitters/regex_spec.rb
|
133
|
-
- spec/lib/phony/national_splitters/
|
129
|
+
- spec/lib/phony/national_splitters/fixed_spec.rb
|
130
|
+
- spec/lib/phony/national_splitters/default_spec.rb
|
131
|
+
- spec/lib/phony/country_codes_spec.rb
|
132
|
+
- spec/lib/phony/local_splitters/regex_spec.rb
|
133
|
+
- spec/lib/phony/local_splitters/fixed_spec.rb
|
134
134
|
- spec/lib/phony/vanity_spec.rb
|
135
|
-
- spec/
|
135
|
+
- spec/functional/plausibility_spec.rb
|