phony 2.12.9 → 2.12.10
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 +4 -4
- data/spec/functional/plausibility_spec.rb +41 -2
- data/spec/lib/phony/countries_spec.rb +45 -4
- 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: 927b163abff186551d579b1e0b6a49b5a2d3dd67
|
4
|
+
data.tar.gz: 2735b15030ea7367c56249cb6a3cf1a0f4dd232a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20435839853a0411af341890288a25e33180488a084f34e4b24a04d6565e2318ff2b93cd25b97a1204e2e69b2c4c6e0c33ad071d49d71c6d771a93547fbf0be1
|
7
|
+
data.tar.gz: 0cde0f504c227516e48fe4e48644a001be014e95d9f2ce622e6354b5961603979c5e7faf9b55a07391b0c470531648653c31eda4b3d7986e07f51d62011af2b1
|
data/lib/phony/countries.rb
CHANGED
@@ -341,11 +341,11 @@ Phony.define do
|
|
341
341
|
|
342
342
|
# Nigeria
|
343
343
|
# Wikipedia says 3 4 split, many local number with no splitting
|
344
|
+
#
|
345
|
+
# mobile telephony number allocation taken from: http://www.ncc.gov.ng/index.php?option=com_content&view=article&id=113&Itemid=102
|
344
346
|
country '234',
|
345
|
-
match(/^(
|
346
|
-
match(/^(
|
347
|
-
match(/^(8[01]\d)\d+$/) >> split(3,4) | # Mobile
|
348
|
-
match(/^(90[2359])\d+$/) >> split(3,4) | # Mobile
|
347
|
+
match(/^([7-9]0\d)\d+$/) >> split(3,4) | # Mobile
|
348
|
+
match(/^(81\d)\d+$/) >> split(3,4) | # Mobile
|
349
349
|
one_of('1', '2', '9') >> split(3,4) | # Lagos, Ibadan and Abuja
|
350
350
|
fixed(2) >> split(3,4) # 2-digit NDC
|
351
351
|
|
@@ -465,9 +465,48 @@ describe 'plausibility' do
|
|
465
465
|
end
|
466
466
|
|
467
467
|
it 'is correct for Nigerian numbers' do
|
468
|
+
Phony.plausible?('+234 700 766 1234').should be_true
|
469
|
+
Phony.plausible?('+234 701 766 1234').should be_true
|
470
|
+
Phony.plausible?('+234 702 766 1234').should be_true
|
471
|
+
Phony.plausible?('+234 703 766 1234').should be_true
|
472
|
+
Phony.plausible?('+234 704 766 1234').should be_true
|
473
|
+
Phony.plausible?('+234 705 766 1234').should be_true
|
474
|
+
Phony.plausible?('+234 706 766 1234').should be_true
|
475
|
+
Phony.plausible?('+234 707 766 1234').should be_true
|
476
|
+
Phony.plausible?('+234 708 766 1234').should be_true
|
477
|
+
Phony.plausible?('+234 709 766 1234').should be_true
|
478
|
+
Phony.plausible?('+234 800 766 1234').should be_true
|
479
|
+
Phony.plausible?('+234 801 766 1234').should be_true
|
480
|
+
Phony.plausible?('+234 802 766 1234').should be_true
|
481
|
+
Phony.plausible?('+234 803 766 1234').should be_true
|
482
|
+
Phony.plausible?('+234 804 766 1234').should be_true
|
483
|
+
Phony.plausible?('+234 805 766 1234').should be_true
|
484
|
+
Phony.plausible?('+234 806 766 1234').should be_true
|
468
485
|
Phony.plausible?('+234 807 766 1234').should be_true
|
469
|
-
Phony.plausible?('+234
|
470
|
-
Phony.plausible?('+234
|
486
|
+
Phony.plausible?('+234 808 766 1234').should be_true
|
487
|
+
Phony.plausible?('+234 809 766 1234').should be_true
|
488
|
+
Phony.plausible?('+234 900 766 1234').should be_true
|
489
|
+
Phony.plausible?('+234 901 766 1234').should be_true
|
490
|
+
Phony.plausible?('+234 902 766 1234').should be_true
|
491
|
+
Phony.plausible?('+234 903 766 1234').should be_true
|
492
|
+
Phony.plausible?('+234 904 766 1234').should be_true
|
493
|
+
Phony.plausible?('+234 905 766 1234').should be_true
|
494
|
+
Phony.plausible?('+234 906 766 1234').should be_true
|
495
|
+
Phony.plausible?('+234 907 766 1234').should be_true
|
496
|
+
Phony.plausible?('+234 908 766 1234').should be_true
|
497
|
+
Phony.plausible?('+234 909 766 1234').should be_true
|
498
|
+
Phony.plausible?('+234 810 766 1234').should be_true
|
499
|
+
Phony.plausible?('+234 811 766 1234').should be_true
|
500
|
+
Phony.plausible?('+234 812 766 1234').should be_true
|
501
|
+
Phony.plausible?('+234 813 766 1234').should be_true
|
502
|
+
Phony.plausible?('+234 814 766 1234').should be_true
|
503
|
+
Phony.plausible?('+234 815 766 1234').should be_true
|
504
|
+
Phony.plausible?('+234 816 766 1234').should be_true
|
505
|
+
Phony.plausible?('+234 817 766 1234').should be_true
|
506
|
+
Phony.plausible?('+234 818 766 1234').should be_true
|
507
|
+
Phony.plausible?('+234 819 766 1234').should be_true
|
508
|
+
|
509
|
+
Phony.plausible?('+234 807 766 123').should be_false # too short
|
471
510
|
end
|
472
511
|
|
473
512
|
it "is correct for Portugese numbers" do
|
@@ -946,10 +946,51 @@ describe 'country descriptions' do
|
|
946
946
|
end
|
947
947
|
describe 'Nigeria' do
|
948
948
|
it_splits '23411231234', %w(234 1 123 1234) # Lagos
|
949
|
-
|
950
|
-
|
951
|
-
it_splits '
|
952
|
-
it_splits '
|
949
|
+
|
950
|
+
# mobile numbers
|
951
|
+
it_splits '2347007661234', %w(234 700 766 1234)
|
952
|
+
it_splits '2347017661234', %w(234 701 766 1234)
|
953
|
+
it_splits '2347027661234', %w(234 702 766 1234)
|
954
|
+
it_splits '2347037661234', %w(234 703 766 1234)
|
955
|
+
it_splits '2347047661234', %w(234 704 766 1234)
|
956
|
+
it_splits '2347057661234', %w(234 705 766 1234)
|
957
|
+
it_splits '2347067661234', %w(234 706 766 1234)
|
958
|
+
it_splits '2347077661234', %w(234 707 766 1234)
|
959
|
+
it_splits '2347087661234', %w(234 708 766 1234)
|
960
|
+
it_splits '2347097661234', %w(234 709 766 1234)
|
961
|
+
|
962
|
+
it_splits '2348007661234', %w(234 800 766 1234)
|
963
|
+
it_splits '2348017661234', %w(234 801 766 1234)
|
964
|
+
it_splits '2348027661234', %w(234 802 766 1234)
|
965
|
+
it_splits '2348037661234', %w(234 803 766 1234)
|
966
|
+
it_splits '2348047661234', %w(234 804 766 1234)
|
967
|
+
it_splits '2348057661234', %w(234 805 766 1234)
|
968
|
+
it_splits '2348067661234', %w(234 806 766 1234)
|
969
|
+
it_splits '2348077661234', %w(234 807 766 1234)
|
970
|
+
it_splits '2348087661234', %w(234 808 766 1234)
|
971
|
+
it_splits '2348097661234', %w(234 809 766 1234)
|
972
|
+
|
973
|
+
it_splits '2349007661234', %w(234 900 766 1234)
|
974
|
+
it_splits '2349017661234', %w(234 901 766 1234)
|
975
|
+
it_splits '2349027661234', %w(234 902 766 1234)
|
976
|
+
it_splits '2349037661234', %w(234 903 766 1234)
|
977
|
+
it_splits '2349047661234', %w(234 904 766 1234)
|
978
|
+
it_splits '2349057661234', %w(234 905 766 1234)
|
979
|
+
it_splits '2349067661234', %w(234 906 766 1234)
|
980
|
+
it_splits '2349077661234', %w(234 907 766 1234)
|
981
|
+
it_splits '2349087661234', %w(234 908 766 1234)
|
982
|
+
it_splits '2349097661234', %w(234 909 766 1234)
|
983
|
+
|
984
|
+
it_splits '2348107661234', %w(234 810 766 1234)
|
985
|
+
it_splits '2348117661234', %w(234 811 766 1234)
|
986
|
+
it_splits '2348127661234', %w(234 812 766 1234)
|
987
|
+
it_splits '2348137661234', %w(234 813 766 1234)
|
988
|
+
it_splits '2348147661234', %w(234 814 766 1234)
|
989
|
+
it_splits '2348157661234', %w(234 815 766 1234)
|
990
|
+
it_splits '2348167661234', %w(234 816 766 1234)
|
991
|
+
it_splits '2348177661234', %w(234 817 766 1234)
|
992
|
+
it_splits '2348187661234', %w(234 818 766 1234)
|
993
|
+
it_splits '2348197661234', %w(234 819 766 1234)
|
953
994
|
end
|
954
995
|
describe 'Niue' do
|
955
996
|
it_splits '6833651', ['683', false, '3651']
|
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.12.
|
4
|
+
version: 2.12.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Hanke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-09 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
|