phony 2.18.6 → 2.18.11
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 -7
- data/lib/phony/countries/austria.rb +2 -2
- data/lib/phony/countries/germany.rb +1 -1
- data/lib/phony/countries/japan.rb +1 -1
- data/spec/functional/plausibility_spec.rb +8 -1
- data/spec/lib/phony/countries_spec.rb +2 -0
- data/spec/lib/phony/country_codes_spec.rb +4 -1
- data/spec/lib/phony/country_spec.rb +9 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dec25f641694c9f28c6d38038e650ee1353ffe7d7756b11f3675a8d2e2edb5d
|
4
|
+
data.tar.gz: 46c14ea65fd3659bd58ae8f6764c723c0647b3bb172b535a1cfc0753b44663c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25fa4f7c4212f45a77cd98bc18c978048d11579de5bb70680108a7e84cbe91a2ffe8935a94a9bbd4f78e9e9a32b675b341ddcaa4367666a0f7d386069352e3a8
|
7
|
+
data.tar.gz: 26b570a3ddbe060b034841ffad3ecf7548d2ed74644e6a56b8790582c66b2144610e99c8bb817ecdcbdd4ca92acc25f19077df08bc2ccc73335bbf8c2fb3dedf
|
data/lib/phony/countries.rb
CHANGED
@@ -386,14 +386,19 @@ Phony.define do
|
|
386
386
|
country '233', fixed(2) >> split(3,4)
|
387
387
|
|
388
388
|
# Nigeria
|
389
|
-
#
|
389
|
+
# 3 4 split for mobile and 1 digit NDC, 3 2 or 3 3 otherwise
|
390
|
+
# Many local numbers with no splitting
|
390
391
|
#
|
391
|
-
# mobile telephony number allocation taken from:
|
392
|
+
# mobile telephony number allocation taken from:
|
393
|
+
# https://www.ncc.gov.ng/technical-regulation/standards/numbering and
|
394
|
+
# https://www.itu.int/oth/T020200009C/en
|
392
395
|
country '234',
|
393
|
-
match(/^([7-9]0\d)\d+$/)
|
394
|
-
match(/^(81\d)\d+$/)
|
395
|
-
one_of('1', '2'
|
396
|
-
|
396
|
+
match(/^([7-9]0\d)\d+$/) >> split(3,4) | # Mobile
|
397
|
+
match(/^(81\d)\d+$/) >> split(3,4) | # Mobile
|
398
|
+
one_of('1', '2') >> split(3,3..4) | # Lagos, Ibadan
|
399
|
+
one_of('9') >> split(3,4) | # Abuja
|
400
|
+
one_of((30..79).map(&:to_s)) >> split(3,2..3) | # 2-digit NDC
|
401
|
+
one_of(%w(82 83 84 85 86 87 88 89)) >> split(3,3) # 2-digit NDC
|
397
402
|
|
398
403
|
country '235', none >> split(4,4) # Chad http://www.wtng.info/wtng-235-td.html
|
399
404
|
country '236', none >> split(4,4) # Central African Republic http://www.wtng.info/wtng-236-cf.html
|
@@ -731,11 +736,12 @@ Phony.define do
|
|
731
736
|
# Monaco
|
732
737
|
#
|
733
738
|
country '377',
|
734
|
-
one_of('6')
|
739
|
+
one_of('6') >> split(2,2,2,2) | # mobile
|
735
740
|
fixed(2) >> split(2,2,2)
|
736
741
|
|
737
742
|
# San Marino
|
738
743
|
country '378',
|
744
|
+
trunk('', :normalize => false) |
|
739
745
|
none >> matched_split(
|
740
746
|
/\A\d{6}\z/ => [3,3],
|
741
747
|
/\A\d+\z/ => [3,3,4]
|
@@ -85,7 +85,7 @@ service = [
|
|
85
85
|
'939'
|
86
86
|
]
|
87
87
|
|
88
|
-
# https://www.rtr.at/en/tk/E129/
|
88
|
+
# https://www.rtr.at/en/tk/E129/Austrian_Numbering_Plan_2011-03-30.pdf
|
89
89
|
#
|
90
90
|
# TODO Add more details.
|
91
91
|
#
|
@@ -97,7 +97,7 @@ Phony.define do
|
|
97
97
|
one_of('800') >> split(6..10) | # Free number length is 9..13
|
98
98
|
one_of(corporate_2digit) >> split(3..11) | # Corporate number length is 5..13
|
99
99
|
one_of(corporate) >> split(2..10) | # Corporate number length is 5..13
|
100
|
-
one_of(ndcs) >> split(
|
100
|
+
one_of(ndcs) >> split(5..10) |
|
101
101
|
one_of('663') >> split(6..8) | # 6..8 digit mobile.
|
102
102
|
one_of(mobile) >> split(4,3..9) |
|
103
103
|
one_of(mobile_2digit) >> split(7..7) | # Separate as mobile contains 676 - 67 violates the prefix rule.
|
@@ -4090,7 +4090,7 @@ Phony.define do
|
|
4090
4090
|
one_of(*service) >> split(3,1..9) |
|
4091
4091
|
one_of(*mobile_4digits) >> split(3,4) |
|
4092
4092
|
one_of(*mobile_3digits) >> split(4,3..4) |
|
4093
|
-
one_of(*ndcs2) >> split(3,
|
4093
|
+
one_of(*ndcs2) >> split(3,1..10) |
|
4094
4094
|
one_of(*ndcs3) >> split(3,1..9) |
|
4095
4095
|
one_of(*ndcs4) >> split(3,0..8) |
|
4096
4096
|
fixed(5) >> split(3,0..7)
|
@@ -403,7 +403,7 @@ ndcs_with_5_subscriber_numbers = %w(
|
|
403
403
|
|
404
404
|
Phony.define do
|
405
405
|
country '81',
|
406
|
-
trunk('0') |
|
406
|
+
trunk('0', :normalize => false, :format => true, :split => true) |
|
407
407
|
one_of('20', '50', '60', '70', '90') >> split(4,4) | # mobile, VoIP telephony
|
408
408
|
one_of(ndcs_with_5_subscriber_numbers) >> split(1,4) |
|
409
409
|
one_of(ndcs_with_6_subscriber_numbers) >> split(2,4) |
|
@@ -46,7 +46,8 @@ describe 'plausibility' do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
context 'specific countries' do
|
49
|
-
it_is_correct_for 'Austria', :samples => '+43 720 116987' # VoIP
|
49
|
+
it_is_correct_for 'Austria', :samples => ['+43 720 116987', # VoIP
|
50
|
+
'+43 463 12345'] # Klagenfurt
|
50
51
|
it_is_correct_for 'Bosnia and Herzegovina', :samples => ['+387 66 666 666',
|
51
52
|
'+387 37 123 456',
|
52
53
|
'+387 33 222 111']
|
@@ -251,6 +252,7 @@ describe 'plausibility' do
|
|
251
252
|
it_is_correct_for 'Gabonese Republic', :samples => '+241 1 627 739'
|
252
253
|
it_is_correct_for 'Gambia', :samples => '+220 989 5148'
|
253
254
|
it_is_correct_for 'Germany', :samples => [
|
255
|
+
'+49 69 155 1',
|
254
256
|
'+49 1577 536 8701'
|
255
257
|
]
|
256
258
|
it_is_correct_for 'Georgia', :samples => ['+995 220 123 45',
|
@@ -353,6 +355,11 @@ describe 'plausibility' do
|
|
353
355
|
end
|
354
356
|
it_is_correct_for 'Nicaragua', :samples => '+505 12 345 678'
|
355
357
|
it_is_correct_for 'Niger', :samples => '+227 1234 5678'
|
358
|
+
it_is_correct_for 'Nigeria', :samples => ['+234 807 059 1111',
|
359
|
+
'+234 811 234 5678',
|
360
|
+
'+234 64 830 00',
|
361
|
+
'+234 1 280 444',
|
362
|
+
'+234 85 123 456']
|
356
363
|
it_is_correct_for 'Niue', :samples => '+683 3791'
|
357
364
|
it_is_correct_for 'Oman', :samples => ['+968 24 423 123',
|
358
365
|
'+968 25 423 123']
|
@@ -1103,6 +1103,8 @@ describe 'country descriptions' do
|
|
1103
1103
|
describe 'Nigeria' do
|
1104
1104
|
it_splits '23411231234', %w(234 1 123 1234) # Lagos
|
1105
1105
|
|
1106
|
+
it_splits '23445123456', %w(234 45 123 456) # Ogoja
|
1107
|
+
|
1106
1108
|
# mobile numbers
|
1107
1109
|
it_splits '2347007661234', %w(234 700 766 1234)
|
1108
1110
|
it_splits '2347017661234', %w(234 701 766 1234)
|
@@ -147,9 +147,12 @@ describe Phony::CountryCodes do
|
|
147
147
|
it "should format luxembourgian numbers" do
|
148
148
|
@countries.formatted('35227855', :format => :international).should eql '+352 27 85 5'
|
149
149
|
end
|
150
|
-
it "should format nigerian numbers" do
|
150
|
+
it "should format nigerian lagosian numbers" do
|
151
151
|
@countries.formatted('23414480000', :format => :international).should eql '+234 1 448 0000'
|
152
152
|
end
|
153
|
+
it "should format nigerian beninese numbers" do
|
154
|
+
@countries.formatted('23452123456', :format => :international).should eql '+234 52 123 456'
|
155
|
+
end
|
153
156
|
it "should format nigerian mobile numbers" do
|
154
157
|
@countries.formatted('2347061234567', :format => :international).should eql '+234 706 123 4567'
|
155
158
|
end
|
@@ -23,7 +23,7 @@ describe Phony::Country do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
context 'regression' do
|
26
|
-
describe '
|
26
|
+
describe 'Iceland' do
|
27
27
|
let(:country) do
|
28
28
|
national_splitter = Phony::NationalSplitters::None.instance_for
|
29
29
|
local_splitter = Phony::LocalSplitters::Fixed.instance_for [3, 4]
|
@@ -35,6 +35,14 @@ describe Phony::Country do
|
|
35
35
|
country.split('112').should == [nil, false, '112']
|
36
36
|
end
|
37
37
|
end
|
38
|
+
describe 'San Marino' do
|
39
|
+
it 'normalizes correctly' do
|
40
|
+
Phony.normalize('+3780549903549').should == '3780549903549'
|
41
|
+
end
|
42
|
+
xit 'automatically adds the sole NC' do
|
43
|
+
Phony.normalize('+378903549').should == '3780549903549'
|
44
|
+
end
|
45
|
+
end
|
38
46
|
end
|
39
47
|
|
40
48
|
context "without special cases (with switzerland)" do
|
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.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Hanke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-15 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
|
@@ -114,8 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
|
-
|
118
|
-
rubygems_version: 2.7.6
|
117
|
+
rubygems_version: 3.0.3
|
119
118
|
signing_key:
|
120
119
|
specification_version: 4
|
121
120
|
summary: Fast international phone number (E164 standard) normalizing, splitting and
|