phony 2.18.17 → 2.18.22
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 +6 -5
- data/lib/phony/countries/serbia.rb +5 -1
- data/spec/functional/plausibility_spec.rb +10 -2
- data/spec/lib/phony/countries_spec.rb +14 -2
- 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: 33847decf186c3bcaef4432c7da7c53276d41f166e503086a13a7052ace738a9
|
4
|
+
data.tar.gz: 1438fb0f95bd1809fcb33dfb0fd45c7b655bdbf67e584ee91a2b5a1ae297757c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51ddf142f68fbb620c8038c2e109a06150168757753847e8afcba52a23ba3124e61c4645a2d4c883f3e511dab6280283624b588f7939662d919aab45586d01bf
|
7
|
+
data.tar.gz: b5f7a23c72d5b75d84567fff91c467c4cc9b28b5a1c6f0b8c2e6c4c586b18e07a8fdb2a6b1312a5cf0a3620c128eda42991c7c504fa843fe744c1b6627510bf1
|
data/lib/phony/countries.rb
CHANGED
@@ -352,13 +352,13 @@ Phony.define do
|
|
352
352
|
|
353
353
|
# Côte d'Ivoire
|
354
354
|
# http://www.wtng.info/wtng-225-ci.html
|
355
|
-
#
|
355
|
+
# https://www.itu.int/dms_pub/itu-t/oth/02/02/T02020000310006PDFE.pdf
|
356
356
|
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Ivory_Coast
|
357
357
|
#
|
358
358
|
# There is no trunk code for this country and several of the mobile prefixes start with 0
|
359
359
|
country '225',
|
360
360
|
trunk('', :normalize => false) |
|
361
|
-
fixed(2) >> split(2,2,2)
|
361
|
+
fixed(2) >> split(2,2,2,2)
|
362
362
|
|
363
363
|
country '226', none >> split(4,4) # Burkina Faso http://www.wtng.info/wtng-226-bf.html
|
364
364
|
country '227', none >> split(4,4) # Niger http://www.wtng.info/wtng-227-ne.html
|
@@ -397,6 +397,7 @@ Phony.define do
|
|
397
397
|
country '234',
|
398
398
|
match(/^([7-9]0\d)\d+$/) >> split(3,4) | # Mobile
|
399
399
|
match(/^(81\d)\d+$/) >> split(3,4) | # Mobile
|
400
|
+
match(/^(91\d)\d+$/) >> split(3,4) | # Mobile
|
400
401
|
one_of('1', '2') >> split(3,3..4) | # Lagos, Ibadan
|
401
402
|
one_of('9') >> split(3,4) | # Abuja
|
402
403
|
one_of((30..79).map(&:to_s)) >> split(3,2..3) | # 2-digit NDC
|
@@ -431,9 +432,9 @@ Phony.define do
|
|
431
432
|
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Rwanda
|
432
433
|
country '250',
|
433
434
|
trunk('0') |
|
434
|
-
one_of('25')
|
435
|
-
match(/^(7[
|
436
|
-
one_of('06')
|
435
|
+
one_of('25') >> split(7) | # Geographic, fixed
|
436
|
+
match(/^(7[2389])/) >> split(7) | # Non-geographic, mobile
|
437
|
+
one_of('06') >> split(6) # Satellite
|
437
438
|
|
438
439
|
country '251', fixed(2) >> split(3, 4) # Ethiopia http://www.wtng.info/wtng-251-et.html
|
439
440
|
|
@@ -8,6 +8,9 @@ Phony.define do
|
|
8
8
|
trunk('0') |
|
9
9
|
one_of(%w(800)) >> split(3,2) | # freephone
|
10
10
|
one_of(%w(808)) >> split(3,2) | # payphone
|
11
|
+
one_of(%w(677 678)) >> matched_split(
|
12
|
+
/\A\d{4}\z/ => [3],
|
13
|
+
/\A\d+\z/ => [3,3]) |
|
11
14
|
one_of(%w(230)) >> matched_split(
|
12
15
|
/\A\d{4}\z/ => [4],
|
13
16
|
/\A\d+\z/ => [3,2]) |
|
@@ -21,6 +24,7 @@ Phony.define do
|
|
21
24
|
one_of(%w(72)) >> split(3,3) | # ISP
|
22
25
|
one_of(%w(60 61 68 69)) >> matched_split(
|
23
26
|
/\A\d{3}\z/ => [3],
|
27
|
+
/\A\d{6}\z/ => [3,3],
|
24
28
|
/\A\d{7}\z/ => [3,4],
|
25
29
|
/\A\d+\z/ => [3,3,4]) | # mobile, voicemail (mobile)
|
26
30
|
one_of(%w(66 63)) >> matched_split(
|
@@ -40,4 +44,4 @@ Phony.define do
|
|
40
44
|
fixed(2) >> matched_split(
|
41
45
|
/\A\d{5}\z/ => [3,2],
|
42
46
|
/\A\d+\z/ => [3,3])
|
43
|
-
end
|
47
|
+
end
|
@@ -192,7 +192,7 @@ describe 'plausibility' do
|
|
192
192
|
Phony.plausible?('+385 60 12 345').should be_truthy # Premium rate
|
193
193
|
Phony.plausible?('+385 62 123 456').should be_truthy # Premium, personal and UAN
|
194
194
|
end
|
195
|
-
it_is_correct_for "Côte d'Ivoire", :samples => '+225
|
195
|
+
it_is_correct_for "Côte d'Ivoire", :samples => '+225 01 9358 8764'
|
196
196
|
it_is_correct_for 'Democratic Republic of Timor-Leste', :samples => ['+670 465 7886', '+670 7465 7886']
|
197
197
|
it_is_correct_for 'Democratic Republic of the Congo', :samples => '+243 80 864 9794'
|
198
198
|
it_is_correct_for 'Diego Garcia', :samples => '+246 123 7686'
|
@@ -399,6 +399,12 @@ describe 'plausibility' do
|
|
399
399
|
'+507 6 123 4567',
|
400
400
|
'+507 2 123 456']
|
401
401
|
it_is_correct_for 'Reunion / Mayotte (new)', :samples => '+262 295 276 964'
|
402
|
+
it_is_correct_for 'Rwanda', :samples => ['+250 72 1234567',
|
403
|
+
'+250 73 1234567',
|
404
|
+
'+250 78 1234567',
|
405
|
+
'+250 79 1234567',
|
406
|
+
'+250 25 1234567',
|
407
|
+
'+250 06 123456']
|
402
408
|
it_is_correct_for 'Saint Helena', :samples => '+290 5134'
|
403
409
|
it_is_correct_for 'Saint Pierre and Miquelon (Collectivité territoriale de la République française)', :samples => '+508 474 714'
|
404
410
|
it_is_correct_for 'Salvador (El)', :samples => [
|
@@ -427,8 +433,10 @@ describe 'plausibility' do
|
|
427
433
|
['+381 11 123 456', '+381 11 123 4567'],
|
428
434
|
'+381 72 123 456',
|
429
435
|
'+381 60 123',
|
430
|
-
'+381 60 123 4567',
|
436
|
+
['+381 60 123 4567', '+381 69 123 456'],
|
431
437
|
'+381 42 123 456',
|
438
|
+
'+381 677 123 456',
|
439
|
+
'+381 678 123 456',
|
432
440
|
'+381 9 123 4567',
|
433
441
|
'+381 60 123',
|
434
442
|
'+381 60 123 456 7890',
|
@@ -677,6 +677,7 @@ describe 'country descriptions' do
|
|
677
677
|
it_splits '250781234567', ['250', '78', '1234567'] # mobile
|
678
678
|
it_splits '250721234567', ['250', '72', '1234567'] # mobile
|
679
679
|
it_splits '250731234567', ['250', '73', '1234567'] # mobile
|
680
|
+
it_splits '250791234567', ['250', '79', '1234567'] # mobile
|
680
681
|
it_splits '250251234567', ['250', '25', '1234567'] # fixed
|
681
682
|
it_splits '25006123456', ['250', '06', '123456'] # fixed
|
682
683
|
end
|
@@ -895,8 +896,8 @@ describe 'country descriptions' do
|
|
895
896
|
it_splits '50622345678', %w(506 2 234 5678)
|
896
897
|
end
|
897
898
|
describe "Côte d'Ivoire" do
|
898
|
-
it_splits '
|
899
|
-
it_splits '
|
899
|
+
it_splits '2250107335518', ['225', '01', '07', '33', '55', '18']
|
900
|
+
it_splits '2250237335518', ['225', '02', '37', '33', '55', '18']
|
900
901
|
end
|
901
902
|
describe 'Democratic Republic of Timor-Leste' do
|
902
903
|
it_splits '6701742945', ['670', false, '174', '2945']
|
@@ -1164,6 +1165,17 @@ describe 'country descriptions' do
|
|
1164
1165
|
it_splits '2349087661234', %w(234 908 766 1234)
|
1165
1166
|
it_splits '2349097661234', %w(234 909 766 1234)
|
1166
1167
|
|
1168
|
+
it_splits '2349107661234', %w(234 910 766 1234)
|
1169
|
+
it_splits '2349117661234', %w(234 911 766 1234)
|
1170
|
+
it_splits '2349127661234', %w(234 912 766 1234)
|
1171
|
+
it_splits '2349137661234', %w(234 913 766 1234)
|
1172
|
+
it_splits '2349147661234', %w(234 914 766 1234)
|
1173
|
+
it_splits '2349157661234', %w(234 915 766 1234)
|
1174
|
+
it_splits '2349167661234', %w(234 916 766 1234)
|
1175
|
+
it_splits '2349177661234', %w(234 917 766 1234)
|
1176
|
+
it_splits '2349187661234', %w(234 918 766 1234)
|
1177
|
+
it_splits '2349197661234', %w(234 919 766 1234)
|
1178
|
+
|
1167
1179
|
it_splits '2348107661234', %w(234 810 766 1234)
|
1168
1180
|
it_splits '2348117661234', %w(234 811 766 1234)
|
1169
1181
|
it_splits '2348127661234', %w(234 812 766 1234)
|
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.18.
|
4
|
+
version: 2.18.22
|
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: 2021-04-06 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
|