phony 2.15.15 → 2.15.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.textile +2 -2
- data/lib/phony/countries/netherlands.rb +3 -1
- data/lib/phony/countries.rb +15 -6
- data/spec/lib/phony/countries_spec.rb +11 -2
- data/spec/lib/phony/country_codes_spec.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3eb8c1122adf708d8a1652cc2d5c70c2efd8a5f
|
4
|
+
data.tar.gz: 65a6b956c6d63af16ec1bedb14a17e86a8c36594
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c099a1c1d395573f470f60c5e646264607e0a1d2559ff8a81862c08779f883831f520af4b87502585cbd4541616a9605deb4d51fcc84d6ff7faea609bfa0a89c
|
7
|
+
data.tar.gz: 58a9720a7a198feab8d83c3a1df52ebfa47954df5e26a56874059b98168d782b9c757d56e1cbb93b796828cee43c5321c611a6723da40a1ed89bc400c677bfe4
|
data/README.textile
CHANGED
@@ -27,7 +27,7 @@ E164 numbers are international numbers with a country dial prefix, usually an ar
|
|
27
27
|
|
28
28
|
It currently handles the countries listed at the end of this README.
|
29
29
|
|
30
|
-
It is covered by roughly
|
30
|
+
It is covered by roughly 2,000 tests (January 2016).
|
31
31
|
If it doesn't work, please "enter an issue":http://github.com/floere/phony/issues or better, fork and "send a pull request":http://github.com/floere/phony/pulls.
|
32
32
|
|
33
33
|
h2. Installation
|
@@ -80,7 +80,7 @@ NB If a country does not have an NDC, @#split@ will return @false@ in the NDC po
|
|
80
80
|
|
81
81
|
h2. List of Handled Countries
|
82
82
|
|
83
|
-
Mildly unmaintained list: Abhas, Afghan, Algerian,
|
83
|
+
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, 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.
|
84
84
|
|
85
85
|
h2. License
|
86
86
|
|
@@ -1,4 +1,5 @@
|
|
1
|
-
# The Netherlands use a variable-length ndc code, thus we use a separate file to not let all_other.rb explode.
|
1
|
+
# The Netherlands use a variable-length ndc code, thus we use a separate file to not let all_other.rb explode. The
|
2
|
+
# latest version of the numbering plan is available at http://wetten.overheid.nl/BWBR0010198/
|
2
3
|
#
|
3
4
|
# Note: The netherlands use a variable ndc format from length 2 to 3.
|
4
5
|
# To save space, we only use ndcs of length 2 (and use the fallback of 3 to handle the rest).
|
@@ -56,6 +57,7 @@ service3 = [
|
|
56
57
|
Phony.define do
|
57
58
|
country '31',
|
58
59
|
trunk('0', :normalize => true) |
|
60
|
+
match(/\A(97[0,9])\d{8}\z/) >> split(4,4) | # machine-to-machine
|
59
61
|
one_of(service) >> split(4,3) |
|
60
62
|
match(/\A(800|900)\d{4}\z/) >> split(4) |
|
61
63
|
one_of(service3) >> split(4,3) |
|
data/lib/phony/countries.rb
CHANGED
@@ -598,11 +598,16 @@ Phony.define do
|
|
598
598
|
# Luxembourg
|
599
599
|
#
|
600
600
|
country '352',
|
601
|
-
|
602
|
-
match(/^(
|
603
|
-
match(/^(
|
604
|
-
match(/^(
|
605
|
-
match(/^([
|
601
|
+
match(/^(2[467]\d{2})\d{4}$/) >> split(2,2) | # 4-digit NDC
|
602
|
+
match(/^(6\d[18])\d+$/) >> split(3,3) | # mobile
|
603
|
+
match(/^(60\d{2})\d{8}$/) >> split(2,2,2,2) | # mobile machine to machine
|
604
|
+
match(/^((2[^467]|[3-9]\d))\d{4}$/) >> split(2,2) | # 2-digit NDC Regular 6 digits number
|
605
|
+
match(/^((2[^467]|[3-9]\d))\d{4}$/) >> split(2,2) | # 2-digit NDC Regular 6 digits number
|
606
|
+
match(/^((2[^467]|[3-9]\d))\d{5}$/) >> split(2,2,1) | # 2-digit NDC Regular 6 digits number w/ 1 digit extension
|
607
|
+
match(/^((2[^467]|[3-9]\d))\d{6}$/) >> split(2,2,2) | # 2-digit NDC Regular 8 digits number or 6 digits with 2 digits extension
|
608
|
+
match(/^((2[^467]|[3-9]\d))\d{7}$/) >> split(2,2,3) | # 2-digit NDC Regular 6 digits with 4 digits extension
|
609
|
+
match(/^((2[^467]|[3-9]\d))\d{8}$/) >> split(2,2,4) | # 2-digit NDC Regular 6 digits number with 4 digits extension
|
610
|
+
match(/^(\d{2})\d{3}$/) >> split(2,2,1) # fallback for 5 digit number
|
606
611
|
|
607
612
|
# country '353' # Republic of Ireland, see special file.
|
608
613
|
|
@@ -942,7 +947,11 @@ Phony.define do
|
|
942
947
|
country '852',
|
943
948
|
none >> split(4,4)
|
944
949
|
|
945
|
-
|
950
|
+
# Macao, China
|
951
|
+
country '853', # Macao, China
|
952
|
+
match(/^(28)\d+$/) >> split(2,4) | # Landline.
|
953
|
+
match(/^(6)\d+$/) >> split(3,4) # Mobile.
|
954
|
+
|
946
955
|
country '854', todo # Spare code
|
947
956
|
|
948
957
|
# Lao People's Democratic Republic http://www.wtng.info/wtng-856-la.html, https://www.numberingplans.com
|
@@ -416,12 +416,16 @@ describe 'country descriptions' do
|
|
416
416
|
end
|
417
417
|
describe 'Luxembourg' do
|
418
418
|
it_splits '352222809', ['352', '22', '28', '09']
|
419
|
-
it_splits '35226222809', ['352', '
|
419
|
+
it_splits '35226222809', ['352', '2622', '28', '09']
|
420
420
|
it_splits '352621123456', ['352', '621', '123', '456']
|
421
|
-
it_splits '3524123456', ['352', '
|
421
|
+
it_splits '3524123456', ['352', '41', '23', '45', '6']
|
422
422
|
it_splits '352602112345678', ['352', '6021', '12', '34', '56', '78']
|
423
423
|
it_splits '352370431', ['352', '37', '04', '31']
|
424
424
|
it_splits '35227855', ['352', '27', '85', '5']
|
425
|
+
it_splits '352445566', ['352', '44', '55', '66']
|
426
|
+
it_splits '352545258', ['352', '54', '52', '58']
|
427
|
+
it_splits '352818181', ['352', '81', '81', '81']
|
428
|
+
it_splits '3523572141', ['352', '35', '72', '14', '1']
|
425
429
|
end
|
426
430
|
describe 'Macedonia' do
|
427
431
|
it_splits '38921234567', ['389', '2', '123', '4567'] # Skopje
|
@@ -430,6 +434,10 @@ describe 'country descriptions' do
|
|
430
434
|
it_splits '38951234567', ['389', '5', '123', '4567'] # Premium
|
431
435
|
it_splits '38971234567', ['389', '7', '123', '4567'] # Mobile
|
432
436
|
end
|
437
|
+
describe 'Macao' do
|
438
|
+
it_splits '85328123456', ["853", "28", "12", "3456"] # Landline
|
439
|
+
it_splits '85361234567', ["853", "6", "123", "4567"] # Mobile
|
440
|
+
end
|
433
441
|
describe 'Malaysia' do
|
434
442
|
it_splits '6082123456', ['60', '82', '123456'] # Kuching
|
435
443
|
it_splits '60312345678', ['60', '3', '12345678'] # Kuala Lumpur
|
@@ -480,6 +488,7 @@ describe 'country descriptions' do
|
|
480
488
|
it_splits '31612345678', ['31', '6', '12', '34', '56', '78'] # mobile
|
481
489
|
it_splits '31201234567', ['31', '20', '123', '4567']
|
482
490
|
it_splits '31222123456', ['31', '222', '123', '456']
|
491
|
+
it_splits '3197012345678', ['31', '970', '1234', '5678'] # machine-to-machine
|
483
492
|
end
|
484
493
|
describe 'Norway' do
|
485
494
|
it_splits '4721234567', ['47',false,'21','23','45','67']
|
@@ -79,13 +79,13 @@ describe Phony::CountryCodes do
|
|
79
79
|
@countries.formatted('352222809', :format => :international).should eql '+352 22 28 09'
|
80
80
|
end
|
81
81
|
it "should format luxembourgian 4-digit ndc numbers" do
|
82
|
-
@countries.formatted('35226222809', :format => :international).should eql '+352
|
82
|
+
@countries.formatted('35226222809', :format => :international).should eql '+352 2622 28 09'
|
83
83
|
end
|
84
84
|
it "should format luxembourgian mobile numbers" do
|
85
85
|
@countries.formatted('352621123456', :format => :international).should eql '+352 621 123 456'
|
86
86
|
end
|
87
87
|
it "should format luxembourgian city numbers" do
|
88
|
-
@countries.formatted('3524123456', :format => :international).should eql '+352
|
88
|
+
@countries.formatted('3524123456', :format => :international).should eql '+352 41 23 45 6'
|
89
89
|
end
|
90
90
|
it "should format luxembourgian machine to machine numbers" do
|
91
91
|
@countries.formatted('352602112345678', :format => :international).should eql '+352 6021 12 34 56 78'
|
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.15.
|
4
|
+
version: 2.15.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Hanke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-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
|
@@ -129,3 +129,4 @@ test_files:
|
|
129
129
|
- spec/lib/phony/national_splitters/none_spec.rb
|
130
130
|
- spec/lib/phony/national_splitters/regex_spec.rb
|
131
131
|
- spec/lib/phony/national_splitters/variable_spec.rb
|
132
|
+
has_rdoc: false
|