phony 2.10.4 → 2.10.5
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 +6 -5
- data/lib/phony/country_codes.rb +1 -1
- data/spec/functional/plausibility_spec.rb +1 -0
- data/spec/lib/phony/countries_spec.rb +7 -0
- 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: 125ff1e9d966b0683eeaa62003d8e16f6484b235
|
4
|
+
data.tar.gz: 4d13c383c23e7508bbdeb78940133a7f5ab431a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 207cb0b24be71b884f8c1715367fc31d4d179170d885aa817963701475ec11b052213afd2e84863569b8fd5855223ce7d91d35aa7e489c28e3b8c54b2acaf427
|
7
|
+
data.tar.gz: 76e5420b85000cc96e691d83b8d23869198224523c098f812efc1a7dc9ead55c7e26b0491a8cac47418ad1a11c6dc4de1f4b6de9f887b1549dfac567982d99c3
|
data/lib/phony/countries.rb
CHANGED
@@ -340,11 +340,12 @@ Phony.define do
|
|
340
340
|
# Nigeria
|
341
341
|
# Wikipedia says 3 4 split, many local number with no splitting
|
342
342
|
country '234',
|
343
|
-
|
344
|
-
match(/^(
|
345
|
-
match(/^(
|
346
|
-
match(/^(
|
347
|
-
|
343
|
+
match(/^(702\d)\d+$/) >> split(3,4) | # Mobile
|
344
|
+
match(/^(70[3-9])\d+$/) >> split(3,4) | # Mobile
|
345
|
+
match(/^(8[01]\d)\d+$/) >> split(3,4) | # Mobile
|
346
|
+
match(/^(90[2359])\d+$/) >> split(3,4) | # Mobile
|
347
|
+
one_of('1', '2', '9') >> split(3,4) | # Lagos, Ibadan and Abuja
|
348
|
+
fixed(2) >> split(3,4) # 2-digit NDC
|
348
349
|
|
349
350
|
country '235', none >> split(4,4) # Chad http://www.wtng.info/wtng-235-td.html
|
350
351
|
country '236', none >> split(4,4) # Central African Republic http://www.wtng.info/wtng-236-cf.html
|
data/lib/phony/country_codes.rb
CHANGED
@@ -459,6 +459,7 @@ describe 'plausibility' do
|
|
459
459
|
it 'is correct for Nigerian numbers' do
|
460
460
|
Phony.plausible?('+234 807 766 1234').should be_true
|
461
461
|
Phony.plausible?('+234 807 766 123').should be_false
|
462
|
+
Phony.plausible?('+234 909 123 1234').should be_true
|
462
463
|
end
|
463
464
|
|
464
465
|
it "is correct for Portugese numbers" do
|
@@ -942,6 +942,13 @@ describe 'country descriptions' do
|
|
942
942
|
describe 'Niger' do
|
943
943
|
it_splits '22712345678', ['227', false, '1234', '5678']
|
944
944
|
end
|
945
|
+
describe 'Nigeria' do
|
946
|
+
it_splits '23411231234', %w(234 1 123 1234) # Lagos
|
947
|
+
it_splits '23470261231234', %w(234 7026 123 1234) # Mobile CDMA
|
948
|
+
it_splits '2347071231234', %w(234 707 123 1234) # Mobile
|
949
|
+
it_splits '2348051231234', %w(234 805 123 1234) # Mobile
|
950
|
+
it_splits '2349091231234', %w(234 909 123 1234) # Mobile
|
951
|
+
end
|
945
952
|
describe 'Niue' do
|
946
953
|
it_splits '6833651', ['683', false, '3651']
|
947
954
|
end
|
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.10.
|
4
|
+
version: 2.10.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: 2015-02-
|
11
|
+
date: 2015-02-25 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
|