phony 2.18.5 → 2.18.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da81c89f8da18101dd1ad489ec5c6e7c66d6f3836058ba9b33f1eb4c02395ea2
4
- data.tar.gz: a8fe8edd6e28d32ad7a0ea2ccdfb69c52897c2163f735b44b3e71e3fed7175ea
3
+ metadata.gz: 65cd9d252c032ff5116a79fa6e5b670f7d482d16534c43d2369c951aeaa01003
4
+ data.tar.gz: b1be2f32723b945d1854ea7b613e3121b95c5870e4704b3f0c42833f9c524271
5
5
  SHA512:
6
- metadata.gz: b36455cfb130e3657e423b331f7a2978fd960be66af3834335506ce3c0a17690bb9775aefacbba1b5a617550e6f42f34b8e7a5c1c9cfb67d6a4d7e95cc2e17b0
7
- data.tar.gz: 82d22fff926d5225418694fdcaa8553f621d529151f870d05530b74b11b9405b3164a67e7bc8bc14638610da58c14f0680939a7762243ec93f4d262f9d7b3b22
6
+ metadata.gz: e12dd75c0642fb9b50527957dbeb470fbc831e732f4e54b1a8ceafe05970db355ed0d4b4097f43bbb7ea98ca99d28aea382b10c51a345bf94976df981666c9e4
7
+ data.tar.gz: 40d2961f1b3fec24505c376deb4252253af59c71eeda0c6b1bb35b4f5bce41a7c8ea99ad4a233e40974bc7cce6f2ae8dd403febf3f09006b4c69fb045635c3a9
@@ -386,14 +386,19 @@ Phony.define do
386
386
  country '233', fixed(2) >> split(3,4)
387
387
 
388
388
  # Nigeria
389
- # Wikipedia says 3 4 split, many local number with no splitting
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: http://www.ncc.gov.ng/index.php?option=com_content&view=article&id=113&Itemid=102
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+$/) >> split(3,4) | # Mobile
394
- match(/^(81\d)\d+$/) >> split(3,4) | # Mobile
395
- one_of('1', '2', '9') >> split(3,4) | # Lagos, Ibadan and Abuja
396
- fixed(2) >> split(3,4) # 2-digit NDC
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') >> split(2,2,2,2) | # mobile
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]
@@ -348,8 +348,8 @@ Phony.define do
348
348
  one_of(area_codes_4digits) >> split(2, 4) | # landline
349
349
  one_of(area_codes_3digits) >> split(3, 4) | # landline
350
350
  one_of(area_codes_2digits) >> split(4, 4) | # landline
351
- one_of(area_codes_2digits.map{|x| "9#{x}" }) >> split(4, 5) | # mobile
352
- one_of(area_codes_3digits.map{|x| "9#{x}" }) >> split(3, 5) | # mobile
353
- one_of(area_codes_4digits.map{|x| "9#{x}" }) >> split(2, 5) | # mobile
351
+ one_of(area_codes_2digits.map{|x| "9#{x}" }) >> split(4, 4) | # mobile
352
+ one_of(area_codes_3digits.map{|x| "9#{x}" }) >> split(3, 4) | # mobile
353
+ one_of(area_codes_4digits.map{|x| "9#{x}" }) >> split(2, 4) | # mobile
354
354
  one_of(special_numbers) >> split(3, 4)
355
355
  end
@@ -85,7 +85,7 @@ service = [
85
85
  '939'
86
86
  ]
87
87
 
88
- # https://www.rtr.at/en/tk/E129/2312_Austrian_Numbering_Plan_2011-03-30.pdf
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(6..10) |
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,2..10) |
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)
@@ -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 'iceland' do
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.5
4
+ version: 2.18.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: 2019-06-28 00:00:00.000000000 Z
11
+ date: 2019-11-20 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
- rubyforge_project:
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