phony 2.18.9 → 2.18.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 062a3448529e9cd54a3b989ab0522ee2035821af37c7b194a1b3167bdb8f1693
4
- data.tar.gz: 6f2b104415be34d29daf0569326a5a7480c6e44f243533e5e0ed51dbe554c699
3
+ metadata.gz: 65cd9d252c032ff5116a79fa6e5b670f7d482d16534c43d2369c951aeaa01003
4
+ data.tar.gz: b1be2f32723b945d1854ea7b613e3121b95c5870e4704b3f0c42833f9c524271
5
5
  SHA512:
6
- metadata.gz: c1e05a38ac40ddf8b69792071ceaf62fe90a66f79ee0ba6992f6022a4ab88ff5d33d33fa9276612e135231f3554f01eb83f551b5c163e7e2f0faf8e0a52417d0
7
- data.tar.gz: d2f5667fd4d32a6bd33961eca81928c2140a5383837f4a027203cad67afa34107560ea80291f35fee06fce9a43417f8e4272cc08b436eed6d5036c9f0aa18769
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
@@ -355,6 +355,11 @@ describe 'plausibility' do
355
355
  end
356
356
  it_is_correct_for 'Nicaragua', :samples => '+505 12 345 678'
357
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']
358
363
  it_is_correct_for 'Niue', :samples => '+683 3791'
359
364
  it_is_correct_for 'Oman', :samples => ['+968 24 423 123',
360
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
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.9
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-11-09 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