phony 2.15.44 → 2.15.46

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: 1fa108fb584dd17a81f785d16e15dee13d88df92
4
- data.tar.gz: a34a89f9767d736726e355dae3e0f5e4bd7226fd
3
+ metadata.gz: 425702e9ff19dfa1d39a04347c5aa17aa68ee0c9
4
+ data.tar.gz: 0d33325a64b947754d840bb30f59288157c06c36
5
5
  SHA512:
6
- metadata.gz: 0ebae7268f7c148285f231f447f174fbda78552d3827b0cb8746e27d2f42ebfaca7c72166b4e4b335d2caf66b002ac0ec2e86fcd6f2b7491058959814580969d
7
- data.tar.gz: 107b5d6e714356813cade294e5d0cd4fa76414119e3b63eb3fdaf2c980cee5c1473df5f84d8fe8708ddc2bbe7cf327f8a8aa48c2c588ae1036afd9efd7822355
6
+ metadata.gz: 944eef26079290a5ed72511efdb219eefe5328918964ad80febc0a368a4e759436cee633cfe3857f9a43c285ad9cd6fe138f770c2da427a252b01290050854f2
7
+ data.tar.gz: 98c7fc92e39eed57867085e44bd77f54965405ffbbce9692c5eb6620cd00b6a895ac7558c7c678c9a5d32f0250cace9dca2ef48ea2b49a91a75c9dd1da426382
@@ -472,9 +472,11 @@ Phony.define do
472
472
 
473
473
  # Zambia
474
474
  # http://www.wtng.info/wtng-260-zm.html
475
+ # https://github.com/googlei18n/libphonenumber/
475
476
  country '260',
476
- match(/^(9(55|66|7[7-9]))/) >> split(6) | # mobile
477
- match(/^(21[1-8])/) >> split(6) # fixed
477
+ match(/^(9(5[034589]|[67]\d))/) >> split(6) | # Mobile
478
+ match(/^(800)/) >> split(3,3) | # Toll free
479
+ match(/^(21[1-8])/) >> split(6) # Fixed
478
480
 
479
481
  # Madagascar http://www.wtng.info/wtng-261-mg.html
480
482
  # http://www.itu.int/oth/T020200007F/en
@@ -751,9 +753,11 @@ Phony.define do
751
753
 
752
754
  # Slovak Republic.
753
755
  #
754
- country '421', match(/^(9\d\d).+$/) >> split(6) | # Mobile
755
- one_of('2') >> split(8) | # Bratislava
756
- fixed(2) >> split(7) # 2-digit NDCs
756
+ country '421', match(/^(9\d\d).+$/) >> split(6) | # Mobile
757
+ match(/\A(2)1\d{2,4}\z/) >> split(3..5) | # Bratislava Short
758
+ match(/\A(\d{2})1\d{2,4}\z/) >> split(3..5) | # 2-digit NDCs Short
759
+ one_of('2') >> split(8) | # Bratislava
760
+ fixed(2) >> split(7) # 2-digit NDCs
757
761
 
758
762
  country '422', todo # Spare code
759
763
  country '423', none >> split(3,2,2) # Liechtenstein (Principality of)
@@ -986,7 +990,8 @@ Phony.define do
986
990
  # Macao, China
987
991
  country '853', # Macao, China
988
992
  match(/^(28)\d+$/) >> split(2,4) | # Landline.
989
- match(/^(6)\d+$/) >> split(3,4) # Mobile.
993
+ match(/^(8)\d+$/) >> split(3,4) | # Landline.
994
+ match(/^(6)\d+$/) >> split(3,4) # Mobile.
990
995
 
991
996
  country '854', todo # Spare code
992
997
 
@@ -3,24 +3,19 @@
3
3
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Croatia
4
4
  # http://dialcode.org/Europe/Croatia/
5
5
  # http://www.howtocallabroad.com/croatia/
6
- #
7
- # Landline numbers are composed by a 2 digits area code + 6 fixed digits
8
- # Mobile numbers are composed by a 2 digits prefix + 7 fixed digits
6
+ # https://github.com/googlei18n/libphonenumber/
9
7
  #
10
8
 
11
- mobile = %w(
12
- 91
13
- 92
14
- 95
15
- 97
16
- 977
17
- 98
18
- 99
19
- )
9
+ landline = /^(2[0-3]|3[1-5]|4[02-47-9]|5[1-3])/
20
10
 
21
11
  Phony.define do
22
12
  country '385', trunk('0') |
23
- one_of(mobile) >> split(3, 4) |
24
- one_of('1') >> split(4, 3) | # Zagreb
25
- fixed(2) >> split(3, 3) # 2-digit NDCs
26
- end
13
+ one_of('1') >> split(4, 3) | # Zagreb
14
+ match(/^(80[01])/) >> matched_split(
15
+ /\A\d{4}\z/ => [4],
16
+ /\A\d{6}\z/ => [3,3]) | # Toll free
17
+ match(/^(9\d)/) >> split(3, 3..4) | # Mobile
18
+ match(landline) >> split(3, 3..4) | # Landline
19
+ match(/^(6[01])/) >> split(2,2..3) | # Premium rate
20
+ match(/^([67]\d)/) >> split(3,3..4) # Premium, personal and UAN
21
+ end
@@ -1,52 +1,25 @@
1
1
  # Taiwan
2
- # https://www.numberingplans.com/?page=dialling&sub=areacodes
3
- #
4
-
5
- ndcs_with_8_subscriber_numbers = %w(1 2)
6
-
7
- ndcs_with_7_subscriber_numbers = %w(3 4 5 6 7 8)
8
-
9
- ndcs_with_6_subscriber_numbers = %w(
10
- 33
11
- 34
12
- 35
13
- 36
14
- 37
15
- 38
16
- 39
17
- 42
18
- 43
19
- 44
20
- 45
21
- 46
22
- 47
23
- 48
24
- 49
25
- 55
26
- 56
27
- 62
28
- 66
29
- 67
30
- 69
31
- 88
32
- 89
33
- )
34
-
35
- ndcs_with_5_subscriber_numbers = %w(823 826 827)
2
+ # https://zh.wikipedia.org/wiki/%E4%B8%AD%E8%8F%AF%E6%B0%91%E5%9C%8B%E9%95%B7%E9%80%94%E9%9B%BB%E8%A9%B1%E5%8D%80%E8%99%9F%E8%A1%A8
3
+ # https://en.wikipedia.org/wiki/Telephone_numbers_in_Taiwan
36
4
 
37
5
  Phony.define do
38
6
  country '886',
39
7
  trunk('0') |
40
- one_of(ndcs_with_5_subscriber_numbers) >> split(3,2) |
41
- match(/\A(6\d\d)\d{7}\z/) >> split(3,4) | # geographic ; Taipei
42
- one_of(%w(412)) >> split(4) | # VoIP telephony ; Taichung
43
- one_of(ndcs_with_6_subscriber_numbers) >> split(3,3) |
44
- one_of(%w(18)) >> split(3,3) | # freephone
45
- one_of(%w(90 91 92 93 95 96 97 98)) >> matched_split(
46
- /\A\d{6}\z/ => [3,3],
47
- /\A\d+\z/ => [3,4]) | # mobile
48
- one_of(%w(60 70 94 95 99)) >> split(3,3) | # pager
49
- one_of(ndcs_with_7_subscriber_numbers) >> split(3,4) |
50
- one_of(ndcs_with_8_subscriber_numbers) >> split(4,4) |
51
- fixed(2) >> split(3,3)
8
+ match(/\A(826)\d{5}\z/) >> split(1,4) | # 烏坵, start with 0826, plus 5 digits
9
+ match(/\A(836)\d{5}\z/) >> split(1,4) | # 馬祖, start with 0836, plus 5 digits
10
+ match(/\A(82)\d{6}\z/) >> split(2,4) | # 金門, start with 082, plus 6 digits
11
+ match(/\A(89)\d{6}\z/) >> split(2,4) | # 臺東, start with 089, plus 6 digits
12
+ match(/\A(8)\d{7}\z/) >> split(3,4) | # 屏東, start with 08, plus 7 digits
13
+ match(/\A(49)\d{7}\z/) >> split(3,4) | # 南投, start with 049, plus 7 digits
14
+ one_of(%w(4)) >> matched_split(
15
+ /\A\d{7}\z/ => [3,4], # 彰化, start with 04, plus 7 digits
16
+ /\A\d+\z/ => [4,4])| # 臺中, start with 04, plus 8 digits
17
+ match(/\A(37)\d{6}\z/) >> split(2,4) | # 苗栗, start with 037, plus 6 digits
18
+ match(/\A(3)\d{7}\z/) >> split(3,4) | # 桃園 新竹 花蓮 宜蘭, start with 03, plus 7 digits
19
+ match(/\A(5)\d{7}\z/) >> split(3,4) | # 嘉義 雲林, start with 05, plus 7 digits
20
+ match(/\A(6)\d{7}\z/) >> split(3,4) | # 臺南 澎湖, start with 06, plus 7 digits
21
+ match(/\A(7)\d{7}\z/) >> split(3,4) | # 高雄, start with 07, plus 7 digits
22
+ match(/\A(2)\d{8}\z/) >> split(4,4) | # 臺北, start with 02, plus 8 digits
23
+ match(/\A(9\d\d)\d{6}\z/) >> split(3,3) | # mobile phone, start with 09, plus 8 digits, but local usually show 4-3-3.
24
+ fixed(2) >> split(4,4) # fallback unknown
52
25
  end
@@ -53,6 +53,16 @@ describe 'plausibility' do
53
53
  it_is_correct_for 'Congo', :samples => '+242 1234 56789'
54
54
  it_is_correct_for 'Cook Islands', :samples => '+682 71928'
55
55
  it_is_correct_for 'Costa Rica', :samples => '+506 2 234 5678'
56
+ it 'is correct for Croatia' do
57
+ Phony.plausible?('+385 21 695 900').should be_true # Landline
58
+ Phony.plausible?('+385 1 4566 666').should be_true # Landline (Zagreb)
59
+ Phony.plausible?('+385 99 444 999').should be_true # Mobile
60
+ Phony.plausible?('+385 91 896 7509').should be_true # Mobile
61
+ Phony.plausible?('+385 800 1234').should be_true # Toll free
62
+ Phony.plausible?('+385 800 123 456').should be_true # Toll free
63
+ Phony.plausible?('+385 60 12 345').should be_true # Premium rate
64
+ Phony.plausible?('+385 62 123 456').should be_true # Premium, personal and UAN
65
+ end
56
66
  it_is_correct_for "Côte d'Ivoire", :samples => '+225 9358 8764'
57
67
  it_is_correct_for 'Democratic Republic of Timor-Leste', :samples => ['+670 465 7886', '+670 7465 7886']
58
68
  it_is_correct_for 'Democratic Republic of the Congo', :samples => '+243 80 864 9794'
@@ -171,6 +181,9 @@ describe 'plausibility' do
171
181
  Phony.plausible?('+231 4 123 456').should be_true
172
182
  Phony.plausible?('+231 77 123 4567').should be_true
173
183
  end
184
+ it_is_correct_for 'Macao', :samples => ['+853 28 12 3456',
185
+ '+853 8 123 4567',
186
+ '+853 6 123 4567',]
174
187
  it_is_correct_for 'Macedonia', :samples => ['+389 2 123 4567',
175
188
  '+389 7 124 3456',
176
189
  '+389 7 234 5678']
@@ -270,15 +283,12 @@ describe 'plausibility' do
270
283
  '+963 31 123 4567',
271
284
  '+963 15 731 234',
272
285
  '+963 9 1234 5678']
273
- it_is_correct_for 'Taiwan', :samples => ['+886 18 123 456',
274
- '+886 612 123 4567',
275
- '+886 2 1234 5678',
286
+ it_is_correct_for 'Taiwan', :samples => ['+886 6 123 4567',
276
287
  '+886 3 123 4567',
277
288
  '+886 33 123 456',
278
289
  '+886 827 123 45',
279
- '+886 412 1234',
280
- ['+886 90 123 456', '+886 90 123 4567'],
281
- '+886 94 991 345']
290
+ '+886 4 123 1234',
291
+ '+886 9 1234 5678']
282
292
  it_is_correct_for 'Tajikistan', :samples => ['+992 3130 123 45',
283
293
  '+992 331700 123',
284
294
  '+992 372 123 345',
@@ -362,8 +372,11 @@ describe 'plausibility' do
362
372
  '+967 77 123 4567',
363
373
  '+967 58 1234']
364
374
  it 'is correct for Zambia' do
365
- Phony.plausible?('+260 955 123456').should be_true # mobile
366
- Phony.plausible?('+260 211 123456').should be_true # fixed
375
+ Phony.plausible?('+260 211 123456').should be_true # Fixed
376
+ Phony.plausible?('+260 955 123456').should be_true # Mobile
377
+ Phony.plausible?('+260 967 123456').should be_true # Mobile
378
+ Phony.plausible?('+260 978 123456').should be_true # Mobile
379
+ Phony.plausible?('+260 800 123 456').should be_true # Toll free
367
380
  end
368
381
  it_is_correct_for 'Zimbabwe', :samples => [['+263 2582 123 456', '+263 2582 123'],
369
382
  ['+263 147 123 456', '+263 147 123'],
@@ -201,7 +201,12 @@ describe 'country descriptions' do
201
201
  describe 'Croatia' do
202
202
  it_splits '38521695900', %w( 385 21 695 900 ) # Landline
203
203
  it_splits '38514566666', %w( 385 1 4566 666 ) # Landline (Zagreb)
204
+ it_splits '38599444999', %w( 385 99 444 999 ) # Mobile
204
205
  it_splits '385918967509', %w( 385 91 896 7509 ) # Mobile
206
+ it_splits '3858001234', %w( 385 800 1234 ) # Toll free
207
+ it_splits '385800123456', %w( 385 800 123 456 ) # Toll free
208
+ it_splits '3856012345', %w( 385 60 12 345 ) # Premium rate
209
+ it_splits '38562123456', %w( 385 62 123 456 ) # Premium, personal and UAN
205
210
  end
206
211
  describe 'Cuba' do
207
212
  it_splits '5351231234', ['53', '5123', '1234'] # Mobile
@@ -474,6 +479,7 @@ describe 'country descriptions' do
474
479
  end
475
480
  describe 'Macao' do
476
481
  it_splits '85328123456', ["853", "28", "12", "3456"] # Landline
482
+ it_splits '85381234567', ["853", "8", "123", "4567"] # Landline
477
483
  it_splits '85361234567', ["853", "6", "123", "4567"] # Mobile
478
484
  end
479
485
  describe 'Malaysia' do
@@ -660,7 +666,9 @@ describe 'country descriptions' do
660
666
  describe 'Slovakia' do
661
667
  it_splits '421912123456', ['421', '912', '123456'] # Mobile
662
668
  it_splits '421212345678', ['421', '2', '12345678'] # Bratislava
669
+ it_splits '4212123', ['421', '2', '123'] # Bratislava Short
663
670
  it_splits '421371234567', ['421', '37', '1234567'] # Nitra / Other
671
+ it_splits '42137123', ['421', '37', '123'] # Nitra / Other Short
664
672
  end
665
673
 
666
674
  describe 'Slovenia' do
@@ -777,8 +785,11 @@ describe 'country descriptions' do
777
785
  it_splits '84412345678', ['84', '4', '1234', '5678'] # Hanoi
778
786
  end
779
787
  describe 'Zambia' do
780
- it_splits '260955123456', ['260', '955', '123456'] # mobile
781
- it_splits '260211123456', ['260', '211', '123456'] # fixed
788
+ it_splits '260211123456', ['260', '211', '123456'] # Fixed
789
+ it_splits '260955123456', ['260', '955', '123456'] # Mobile
790
+ it_splits '260967123456', ['260', '967', '123456'] # Mobile
791
+ it_splits '260978123456', ['260', '978', '123456'] # Mobile
792
+ it_splits '260800123456', ['260', '800', '123', '456'] # Toll free
782
793
  end
783
794
  describe 'New Zealand' do
784
795
  it_splits '6491234567', ['64', '9', '123', '4567']
@@ -1211,16 +1222,21 @@ describe 'country descriptions' do
1211
1222
  it_splits '963912345678', %w(963 9 1234 5678)
1212
1223
  end
1213
1224
  describe 'Taiwan' do
1214
- it_splits '88618123456', %w(886 18 123 456)
1215
- it_splits '8866121234567', %w(886 612 123 4567)
1216
1225
  it_splits '886212345678', %w(886 2 1234 5678)
1217
1226
  it_splits '88631234567', %w(886 3 123 4567)
1218
- it_splits '88633123456', %w(886 33 123 456)
1219
- it_splits '88682712345', %w(886 827 123 45)
1220
- it_splits '8864121234', %w(886 412 1234)
1221
- it_splits '88690123456', %w(886 90 123 456)
1222
- it_splits '886901234567', %w(886 90 123 4567)
1223
- it_splits '88694991345', %w(886 94 991 345)
1227
+ it_splits '88651234567', %w(886 5 123 4567)
1228
+ it_splits '88661234567', %w(886 6 123 4567)
1229
+ it_splits '88671234567', %w(886 7 123 4567)
1230
+ it_splits '88633123456', %w(886 3 312 3456)
1231
+ it_splits '88637123456', %w(886 37 12 3456)
1232
+ it_splits '88682712345', %w(886 82 71 2345)
1233
+ it_splits '88689712345', %w(886 89 71 2345)
1234
+ it_splits '88682672345', %w(886 826 7 2345)
1235
+ it_splits '88683672345', %w(886 836 7 2345)
1236
+ it_splits '88641212345', %w(886 4 121 2345)
1237
+ it_splits '886412123456', %w(886 4 1212 3456)
1238
+ it_splits '886491234567', %w(886 49 123 4567)
1239
+ it_splits '886901234567', %w(886 901 234 567)
1224
1240
  end
1225
1241
  describe 'Togolese Republic' do
1226
1242
  it_splits '22812345678', ['228', false, '1234', '5678']
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.15.44
4
+ version: 2.15.46
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Hanke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-03 00:00:00.000000000 Z
11
+ date: 2017-06-23 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