phony 2.15.29 → 2.15.30
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.rb +13 -2
- data/lib/phony/countries/indonesia.rb +3 -1
- data/spec/functional/plausibility_spec.rb +33 -1
- data/spec/lib/phony/countries_spec.rb +32 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a95efd861638e45e6481cb045402657210e257ce
|
|
4
|
+
data.tar.gz: 1a30bc92058003997101179806c701bdd91cd8bf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 954b3d729540e8db55394fa70ec550b77087b59cf4dfcc01d07743fed592c141fef232b66620482a0d5a98af673697a98d3e08b840451cdf7e103d89eb2b61ca
|
|
7
|
+
data.tar.gz: fc49bb807e7615a33c83b1a89ac3941d9cfafa1446f410c9aadb777dee1e8bd5e0683443fec108a2690057cf7bdf700ae28c5a5387599902765bad30bdb01b9d
|
data/lib/phony/countries.rb
CHANGED
|
@@ -612,8 +612,12 @@ Phony.define do
|
|
|
612
612
|
# country '353' # Republic of Ireland, see special file.
|
|
613
613
|
|
|
614
614
|
country '354', none >> split(3,4) # Iceland
|
|
615
|
+
|
|
616
|
+
# Albania
|
|
617
|
+
# https://en.wikipedia.org/wiki/Telephone_numbers_in_Albania
|
|
615
618
|
country '355', trunk('0') |
|
|
616
|
-
one_of('4') >> split(4
|
|
619
|
+
one_of('4') >> split(3,4) | # Tirana
|
|
620
|
+
match(/\A(6[6-9])\d*\z/) >> split(3,4) | # mobile
|
|
617
621
|
match(/\A(2[24]|3[2-5]|47|5[2-5]|6[6-9]|8[2-5])\d*\z/) >> split(3,3) |
|
|
618
622
|
fixed(3) >> split(3,2)
|
|
619
623
|
|
|
@@ -808,7 +812,14 @@ Phony.define do
|
|
|
808
812
|
one_of(%w(11 16 17 18 19)) >> split(3) | # audiotext
|
|
809
813
|
fixed(3) >> split(4) # geographic, audiotext
|
|
810
814
|
|
|
811
|
-
|
|
815
|
+
# Ecuador http://www.wtng.info/wtng-593-ec.html
|
|
816
|
+
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=EC¤t_page=1
|
|
817
|
+
# https://en.wikipedia.org/wiki/Telephone_numbers_in_Ecuador
|
|
818
|
+
country '593',
|
|
819
|
+
one_of('9') >> split(4,4) |
|
|
820
|
+
match(/\A([\d]{2})\d{7}\z/) >> split(3,4) |
|
|
821
|
+
fixed(1) >> split(3,4)
|
|
822
|
+
|
|
812
823
|
country '594', fixed(3) >> split(3, 3) # French Guiana (French Department of) http://www.wtng.info/wtng-594-fr.html
|
|
813
824
|
|
|
814
825
|
# country '595' # Paraguay (Republic of), see special file
|
|
@@ -11,7 +11,9 @@ Phony.define do
|
|
|
11
11
|
/\A\d+\z/ => [4,4]) |
|
|
12
12
|
one_of(%w(22 23 24 25 26 27 28 29 31 32 33 34 35 36 37 38 39 72)) >> matched_split(
|
|
13
13
|
/\A\d{5}\z/ => [3,2],
|
|
14
|
-
/\A\d
|
|
14
|
+
/\A\d{7}\z/ => [3,4],
|
|
15
|
+
/\A\d{8}\z/ => [4,4],
|
|
16
|
+
/\A\d{9}\z/ => [3,3,3]) |
|
|
15
17
|
one_of('70') >> split(3,3) |
|
|
16
18
|
one_of(%w(71 73 74 75 76 77)) >> matched_split(
|
|
17
19
|
/\A\d{6}\z/ => [3,3],
|
|
@@ -55,7 +55,32 @@ describe 'plausibility' do
|
|
|
55
55
|
it_is_correct_for 'Democratic Republic of the Congo', :samples => '+243 80 864 9794'
|
|
56
56
|
it_is_correct_for 'Diego Garcia', :samples => '+246 123 7686'
|
|
57
57
|
it_is_correct_for 'Djibouti', :samples => '+253 3671 1431'
|
|
58
|
-
|
|
58
|
+
it 'is correct for Ecuador' do
|
|
59
|
+
Phony.plausible?('+593 22 000 0000').should be_true
|
|
60
|
+
Phony.plausible?('+593 23 000 0000').should be_true
|
|
61
|
+
Phony.plausible?('+593 26 000 0000').should be_true
|
|
62
|
+
Phony.plausible?('+593 27 000 0000').should be_true
|
|
63
|
+
Phony.plausible?('+593 44 000 0000').should be_true
|
|
64
|
+
Phony.plausible?('+593 45 000 0000').should be_true
|
|
65
|
+
Phony.plausible?('+593 47 000 0000').should be_true
|
|
66
|
+
Phony.plausible?('+593 2 200 0000').should be_true
|
|
67
|
+
Phony.plausible?('+593 2 300 0000').should be_true
|
|
68
|
+
Phony.plausible?('+593 2 400 0000').should be_true
|
|
69
|
+
Phony.plausible?('+593 2 500 0000').should be_true
|
|
70
|
+
Phony.plausible?('+593 2 700 0000').should be_true
|
|
71
|
+
Phony.plausible?('+593 3 000 0000').should be_true
|
|
72
|
+
Phony.plausible?('+593 4 000 0000').should be_true
|
|
73
|
+
Phony.plausible?('+593 4 500 0000').should be_true
|
|
74
|
+
Phony.plausible?('+593 4 600 0000').should be_true
|
|
75
|
+
Phony.plausible?('+593 5 200 0000').should be_true
|
|
76
|
+
Phony.plausible?('+593 5 300 0000').should be_true
|
|
77
|
+
Phony.plausible?('+593 6 200 0000').should be_true
|
|
78
|
+
Phony.plausible?('+593 7 200 0000').should be_true
|
|
79
|
+
Phony.plausible?('+593 7 300 0000').should be_true
|
|
80
|
+
Phony.plausible?('+593 7 400 0000').should be_true
|
|
81
|
+
Phony.plausible?('+593 7 600 0000').should be_true
|
|
82
|
+
Phony.plausible?('+593 9 0000 0000').should be_true # mobile
|
|
83
|
+
end
|
|
59
84
|
it_is_correct_for 'Equatorial Guinea', :samples => ['+240 222 201 123',
|
|
60
85
|
'+240 335 201 123']
|
|
61
86
|
it_is_correct_for 'Eritrea', :samples => '+291 6 334 475'
|
|
@@ -341,6 +366,13 @@ describe 'plausibility' do
|
|
|
341
366
|
['+263 270 123 456', '+263 270 123 45'],
|
|
342
367
|
'+263 86 1235 4567']
|
|
343
368
|
|
|
369
|
+
it 'is correct for Indonesia' do
|
|
370
|
+
Phony.plausible?('+62 22 000 0').should be_false
|
|
371
|
+
Phony.plausible?('+62 22 000 00').should be_true
|
|
372
|
+
Phony.plausible?('+62 22 000 0000').should be_true
|
|
373
|
+
Phony.plausible?('+62 22 0000 0000').should be_true
|
|
374
|
+
Phony.plausible?('+62 22 000 000 000').should be_true
|
|
375
|
+
end
|
|
344
376
|
end
|
|
345
377
|
end
|
|
346
378
|
end
|
|
@@ -21,6 +21,12 @@ describe 'country descriptions' do
|
|
|
21
21
|
it_splits '93201234567', ['93', '20', '1234567'] # Kabul
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
describe 'Albania' do
|
|
25
|
+
it_splits '355691234567', ['355', '69', '123', '4567'] # Mobile 7 digits
|
|
26
|
+
it_splits '35569123456', ['355', '69', '123', '456'] # Mobile 6 digits
|
|
27
|
+
it_splits '35541234567', ['355', '4', '123', '4567'] # Tirana
|
|
28
|
+
end
|
|
29
|
+
|
|
24
30
|
describe 'Algeria' do
|
|
25
31
|
it_splits '213211231234', ['213', '21', '123', '1234'] # Algiers
|
|
26
32
|
it_splits '213331231234', ['213', '33', '123', '1234'] # Batna
|
|
@@ -313,6 +319,8 @@ describe 'country descriptions' do
|
|
|
313
319
|
it_splits '622112345567', %w(62 21 1234 5567)
|
|
314
320
|
it_splits '622212345', %w(62 22 123 45)
|
|
315
321
|
it_splits '62221234567', %w(62 22 123 4567)
|
|
322
|
+
it_splits '622200000000', %w(62 22 0000 0000)
|
|
323
|
+
it_splits '6222000000000', %w(62 22 000 000 000)
|
|
316
324
|
it_splits '624311234', %w(62 4 311 234)
|
|
317
325
|
it_splits '62431123456', %w(62 4 3112 3456)
|
|
318
326
|
it_splits '6262212345', %w(62 6 221 2345)
|
|
@@ -801,7 +809,30 @@ describe 'country descriptions' do
|
|
|
801
809
|
it_splits '25349828978', ['253', false, '4982', '8978']
|
|
802
810
|
end
|
|
803
811
|
describe 'Ecuador' do
|
|
804
|
-
it_splits '
|
|
812
|
+
it_splits '593220000000', %w(593 22 000 0000)
|
|
813
|
+
it_splits '59322000000', %w(593 2 200 0000)
|
|
814
|
+
it_splits '593230000000', %w(593 23 000 0000)
|
|
815
|
+
it_splits '59323000000', %w(593 2 300 0000)
|
|
816
|
+
it_splits '59324000000', %w(593 2 400 0000)
|
|
817
|
+
it_splits '59325000000', %w(593 2 500 0000)
|
|
818
|
+
it_splits '593260000000', %w(593 26 000 0000)
|
|
819
|
+
it_splits '59327000000', %w(593 2 700 0000)
|
|
820
|
+
it_splits '593270000000', %w(593 27 000 0000)
|
|
821
|
+
it_splits '59330000000', %w(593 3 000 0000)
|
|
822
|
+
it_splits '59340000000', %w(593 4 000 0000)
|
|
823
|
+
it_splits '593440000000', %w(593 44 000 0000)
|
|
824
|
+
it_splits '593450000000', %w(593 45 000 0000)
|
|
825
|
+
it_splits '59345000000', %w(593 4 500 0000)
|
|
826
|
+
it_splits '59346000000', %w(593 4 600 0000)
|
|
827
|
+
it_splits '593470000000', %w(593 47 000 0000)
|
|
828
|
+
it_splits '59352000000', %w(593 5 200 0000)
|
|
829
|
+
it_splits '59353000000', %w(593 5 300 0000)
|
|
830
|
+
it_splits '59362000000', %w(593 6 200 0000)
|
|
831
|
+
it_splits '59372000000', %w(593 7 200 0000)
|
|
832
|
+
it_splits '59373000000', %w(593 7 300 0000)
|
|
833
|
+
it_splits '59374000000', %w(593 7 400 0000)
|
|
834
|
+
it_splits '59376000000', %w(593 7 600 0000)
|
|
835
|
+
it_splits '593900000000', %w(593 9 0000 0000)
|
|
805
836
|
end
|
|
806
837
|
describe 'Eritrea' do
|
|
807
838
|
it_splits '2916537192', %w(291 6 537 192)
|
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.30
|
|
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-09-14 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
|