phony 2.8.3 → 2.8.4

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
  SHA1:
3
- metadata.gz: 18b2b6b4d8894f7063f3f1ffdb80cc0f5ed8eb17
4
- data.tar.gz: 9f7222a28e4ed77f6d7835078efd734f65c23e2a
3
+ metadata.gz: 5b20a704d057c3295d795f4dfcf235a5bf2b1220
4
+ data.tar.gz: fb1ffb2faf783720497b8d3f758edd0183f2bc7e
5
5
  SHA512:
6
- metadata.gz: 3dce67e5a63cf8a758548797d635e9fb11ef9fc8e146a0e30d1c4d7cff79373ff18efe5fc17f51a4ac5a1b3989747bfc05f9570e92b9440fda06cbcd31128783
7
- data.tar.gz: ed5c196a136597a22540715db57bf7bb63128904a86db0fb0c97646ffc3bb885f188aab933829c4659dceaadee1ddee8549e4c545cf0e27e16a42aa3007f27f4
6
+ metadata.gz: 3abcaf915fec92569f7ea4c74d72aa76e685341dafeeb238c0434d9a05e22c30ce787e965bc0b79a050e074c672dc7bf0fa9686c8fe852d94662bbd564423a70
7
+ data.tar.gz: 4dca85b010dc5009d7e698fb325d785781546096f2943887ffaf203d9e4791c3d123abebcf1a3e2540a9ee039ac4649a2be9546a90c1ac7f9179f6ca7deaa304
@@ -89,7 +89,7 @@ Phony.define do
89
89
  one_of(corporate) >> split(5..5) |
90
90
  one_of(ndcs) >> split(6..6) |
91
91
  one_of('663') >> split(6..6) | # 6 digit mobile.
92
- one_of(mobile) >> split(4,3..4) |
92
+ one_of(mobile) >> split(4,3..9) |
93
93
  one_of(mobile_2digit) >> split(7..7) | # Separate as mobile contains 676 - 67 violates the prefix rule.
94
94
  fixed(4) >> split(7..7)
95
95
  end
@@ -112,7 +112,7 @@ service = [ # Not exhaustive.
112
112
  Phony.define do
113
113
  country '39', trunk('0', :normalize => false) |
114
114
  one_of(*service) >> split(3,3) |
115
- one_of(*mobile) >> split(3,4) |
115
+ one_of(*mobile) >> split(3,4,-1..1) |
116
116
  one_of(*ndcs_2digit) >> split(4,4) |
117
117
  one_of(*ndcs_3digit) >> split(6..7) |
118
118
  one_of(*ndcs_4digit) >> split(3,3)
@@ -63,7 +63,7 @@ Phony.define do
63
63
  one_of(%w(901 909)) >> split(3,4) | # premium rate
64
64
  one_of(%w(21 22 23 24 25 26 27 28)) >> split(4,4) |
65
65
  one_of('50') >> split(4,4) | # VPN
66
- one_of('69') >> split(4,4) | # mobile, pager
66
+ match(/^(69\d)\d+$/) >> split(3,4) | # mobile, pager
67
67
  one_of('70') >> split(4,4) | # universal access
68
68
  fixed(4) >> split(6) # 3-digit NDCs
69
69
 
@@ -612,8 +612,8 @@ Phony.define do
612
612
  # Estonia
613
613
  #
614
614
  country '372',
615
- match(/^(5\d\d\d)\d+$/) >> split(4) | # Mobile
616
- match(/^((?:70|8[12])\d\d)\d+$/) >> split(4) | # Mobile
615
+ match(/^(5\d\d\d)\d+$/) >> split(3..4) | # Mobile
616
+ match(/^((?:70|8[12])\d\d)\d+$/) >> split(4) | # Mobile
617
617
  fixed(3) >> split(4) # 3-digit NDCs
618
618
 
619
619
  # country '373' # Moldova, see special file
@@ -652,7 +652,15 @@ Phony.define do
652
652
 
653
653
  # country '385' # Croatia, see special file.
654
654
 
655
- country '386', trunk('0') | fixed(2) >> split(3, 2, 2) # Slovenia
655
+ # Slovenia
656
+ # http://www.itu.int/oth/default.aspx?lang=en&parent=T02020000BE
657
+ # http://en.wikipedia.org/wiki/Telephone_numbers_in_Slovenia
658
+ country '386',
659
+ trunk('0') |
660
+ one_of('30','31','40','41','51','64','65','66','67','68','69','70','71') >> split(3,3) | # Mobile
661
+ one_of('1','2','3','4','5','7') >> split(3,4) | # Ljubljana, Maribor, Celje, Kranj, Nova Gorica, Novo mesto
662
+ fixed(3) >> split(2,3) # catchall
663
+
656
664
  country '387', trunk('0') | fixed(2) >> split(3,2,2) # Bosnia and Herzegovina
657
665
  country '388', trunk('0') | fixed(2) >> split(3,2,2) # Group of countries, shared code
658
666
  country '389', trunk('0') | fixed(2) >> split(3,2,2) # The Former Yugoslav Republic of Macedonia
@@ -148,6 +148,11 @@ describe 'plausibility' do
148
148
  Phony.plausible?('+43 699 00000000').should be_true
149
149
  # 663 mobile numbers have 6 digits
150
150
  Phony.plausible?('+43 663 000000').should be_true
151
+ # mobile numbers can have from 7 to 10 digits in the subscriber number
152
+ Phony.plausible?('+43 664 1234 567').should be_true
153
+ Phony.plausible?('+43 664 1234 5678').should be_true
154
+ Phony.plausible?('+43 664 1234 56789').should be_true
155
+ Phony.plausible?('+43 664 1234 567890').should be_true
151
156
  end
152
157
 
153
158
  it "is correct for Belgian numbers" do
@@ -304,6 +309,22 @@ describe 'plausibility' do
304
309
  Phony.plausible?('+45 44 55 22 33').should be_true
305
310
  end
306
311
 
312
+ it "is correct for Estonia" do
313
+ # the 5xxxx mobile numbers can be 7 or 8 digits (ndc + subscriber) long
314
+ Phony.plausible?('+372 532 12345').should be_true
315
+ Phony.plausible?('+372 532 1234').should be_true
316
+ Phony.plausible?('+372 532 123').should be_false
317
+ Phony.plausible?('+372 532 123456').should be_false
318
+
319
+ # the 81x/82x are only 8 digits
320
+ Phony.plausible?('+372 822 12345').should be_true
321
+ Phony.plausible?('+372 812 12345').should be_true
322
+ Phony.plausible?('+372 822 1234').should be_false
323
+ Phony.plausible?('+372 812 1234').should be_false
324
+ Phony.plausible?('+372 822 123').should be_false
325
+ Phony.plausible?('+372 822 123456').should be_false
326
+ end
327
+
307
328
  it 'is correct for Netherlands' do
308
329
  Phony.plausible?('+31 6 12 34 56 78').should be_true
309
330
  Phony.plausible?('+31 6 12 34 56 7').should be_false
@@ -384,8 +405,12 @@ describe 'plausibility' do
384
405
  Phony.plausible?('+39 0471 123 456').should be_true
385
406
 
386
407
  # Mobile
387
- Phony.plausible?('+39 335 123 4567').should be_true
388
408
  Phony.plausible?('+39 335 123').should be_false
409
+ Phony.plausible?('+39 335 123 45').should be_false
410
+ Phony.plausible?('+39 335 123 456').should be_true
411
+ Phony.plausible?('+39 335 123 4567').should be_true
412
+ Phony.plausible?('+39 335 123 45678').should be_true
413
+ Phony.plausible?('+39 335 123 456789').should be_false
389
414
  end
390
415
 
391
416
  it 'is correct for Malaysia' do
@@ -429,6 +454,12 @@ describe 'plausibility' do
429
454
  Phony.plausible?('796030123451').should be_false # too long
430
455
  end
431
456
 
457
+ it "is correct for Slovenian numbers" do
458
+ Phony.plausible?('+386 41 123 456').should be_true
459
+ Phony.plausible?('+386 1 320 1234').should be_true
460
+ Phony.plausible?('+386 41 123 4567').should be_false
461
+ end
462
+
432
463
  # TODO: more needs to be done here
433
464
  #
434
465
  it "is correct for Swiss numbers" do
@@ -45,6 +45,12 @@ describe 'country descriptions' do
45
45
  it_splits '4366900000000', %w( 43 669 0000 0000 ) # Mobile
46
46
  it_splits '433161234567891', %w( 43 316 1234567891 ) # Graz
47
47
  it_splits '432164123456789', %w( 43 2164 123456789 ) # Rohrau
48
+
49
+ # mobile numbers can have from 7 to 10 digits in the subscriber number
50
+ it_splits '436641234567', %w( 43 664 1234 567 )
51
+ it_splits '4366412345678', %w( 43 664 1234 5678 )
52
+ it_splits '43664123456789', %w( 43 664 1234 56789 )
53
+ it_splits '436641234567890', %w( 43 664 1234 567890 )
48
54
  end
49
55
 
50
56
  describe 'Australia' do
@@ -188,7 +194,8 @@ describe 'country descriptions' do
188
194
  it_splits '3728001234', ['372', '800', '1234'] # Freephone
189
195
  it_splits '37281231234', ['372', '8123', '1234'] # Mobile
190
196
  it_splits '37282231234', ['372', '8223', '1234'] # Mobile
191
- it_splits '37283212345', ['372', '832', '12345'] # Mobile
197
+ it_splits '37252212345', ['372', '5221', '2345'] # Mobile
198
+ it_splits '3725221234', ['372', '5221', '234'] # Mobile
192
199
  it_splits '37270121234', ['372', '7012', '1234'] # Premium
193
200
  end
194
201
  describe 'Finland' do
@@ -243,7 +250,7 @@ describe 'country descriptions' do
243
250
  it_splits '302142345678', %w(30 21 4234 5678)
244
251
  it_splits '302442345678', %w(30 24 4234 5678)
245
252
  it_splits '305034571234', %w(30 50 3457 1234)
246
- it_splits '306901234567', %w(30 69 0123 4567)
253
+ it_splits '306901234567', %w(30 690 123 4567)
247
254
  it_splits '307001234567', %w(30 70 0123 4567)
248
255
  it_splits '308001001234', %w(30 800 100 1234)
249
256
  it_splits '308011001234', %w(30 801 100 1234)
@@ -351,7 +358,9 @@ describe 'country descriptions' do
351
358
  it_splits '9701700123123', ['970', '1', '700', '123', '123'] # Cable Phone Services
352
359
  end
353
360
  describe 'Italy' do
354
- it_splits '3934869528', ['39', '348', '695', '28'] # Mobile
361
+ it_splits '39348695281', ['39', '348', '695', '281'] # Mobile (6-digit subscriber no. - rare, but still used)
362
+ it_splits '393486952812', ['39', '348', '695', '2812'] # Mobile (7-digit subscriber no. - common)
363
+ it_splits '3934869528123',['39', '348', '695', '2812', '3'] # Mobile (8-digit subscriber no - new)
355
364
  it_splits '393357210488', ['39', '335', '721', '0488'] # Mobile
356
365
  it_splits '393248644272', ['39', '324', '864', '4272'] # Mobile
357
366
  it_splits '390612341234', ['39', '06', '1234', '1234'] # Roma
@@ -570,6 +579,11 @@ describe 'country descriptions' do
570
579
  it { Phony.split('421371234567').should == ['421', '37', '1234567'] } # Nitra / Other
571
580
  end
572
581
 
582
+ describe 'Slovenia' do
583
+ it { Phony.split('38651234567').should == ['386', '51', '234', '567'] } # Mobile
584
+ it { Phony.split('38611234567').should == ['386', '1', '123', '4567'] } # LJUBLJANA
585
+ end
586
+
573
587
  describe 'Spain' do
574
588
  it_splits '34600123456', ['34', '600', '123', '456'] # Mobile
575
589
  it_splits '34900123456', ['34', '900', '123', '456'] # Special
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.8.3
4
+ version: 2.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Hanke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-20 00:00:00.000000000 Z
11
+ date: 2014-12-02 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