phony 2.20.0 → 2.20.2

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: 53e35e946aea7db6e2c7901a5df43de446fc04289fa976f4d2d655a09f4bdbae
4
- data.tar.gz: f7f0cb0e4ee68d31a754d2c57fcde82116907fced053416c630eafcf71e8cd12
3
+ metadata.gz: 53a198dfed227f85433f10698121865171a91f11cbb7392aaed13f256e60ef90
4
+ data.tar.gz: 943807c4e1d75b405da5c39876285c551fea05a135f3b618ae7d0529e723653b
5
5
  SHA512:
6
- metadata.gz: 4e43b987e4313294e70a389da3441e364c8c0cd4930344c2beaadaef58cc60afdf3fc8f265e75923968f8dba565988237067375d41f9546f1dae1c9d258c6aa3
7
- data.tar.gz: b3d7ba6dd615c1d36be9b284da5a578c1f8d11937230bf73185f172250c74d17ffb5a00fe2002f787731c2970587c3e19c1be012469227f28763563389c2da95
6
+ metadata.gz: 3837520d9b0bcf6e249512af63d6e8cbb2b4e9960103577ff451b2aada44aab61f0c557af6cfdd4617d433670ec6030272ea8bc988c4d3e02bdcf433d2b41864
7
+ data.tar.gz: b790b37631700657e0afeb07d2bbb688fcf2ff72f00759112259f848f9b9edee4c4d40c17e68843d6e24ab3aee96beb23deb37b59708a3520c06bab3e7fa2f97
@@ -256,7 +256,8 @@ ndcs_3digit = [
256
256
  # but this was not frozen so easily.
257
257
  mobile = %w(300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399)
258
258
 
259
- service = [ # Not exhaustive.
259
+ # Not exhaustive.
260
+ service = [
260
261
  '112',
261
262
  '113',
262
263
  '115',
@@ -268,11 +269,19 @@ service = [ # Not exhaustive.
268
269
  '1530'
269
270
  ]
270
271
 
272
+ # Not exhaustive. Unused below - just for info purposes.
273
+ free_of_charge_services = [
274
+ '800',
275
+ '803'
276
+ ]
277
+
271
278
  Phony.define do
272
279
  # Note: The 0 does not count towards NDC number length.
273
280
  country '39', trunk('', normalize: false) |
274
281
  one_of(*service) >> split(3,3) |
275
282
  one_of(*mobile) >> split(3,4,-1..1) |
283
+ match(/^(800)\d{6}$/) >> split(6) | # 3-6, Special handling for 800 numbers.
284
+ match(/^(803)\d{3}$/) >> split(3) | # 3-3, Special handling for 803 numbers.
276
285
  one_of(*ndcs_1digit) >> matched_split(
277
286
  /\A\d{5}\z/ => [5],
278
287
  /\A\d{6}\z/ => [4,2],
@@ -489,13 +489,14 @@ Phony.define do
489
489
  # http://www.wtng.info/wtng-260-zm.html
490
490
  # https://github.com/googlei18n/libphonenumber/
491
491
  # https://en.wikipedia.org/wiki/Telephone_numbers_in_Zambia
492
+
492
493
  country '260',
493
494
  trunk('0') |
494
- match(/^(76|77|95|96|97)/) >> split(3, 4) | # Mobile
495
+ match(/^(75|76|77|94|95|96|97)/) >> split(3, 4) | # Mobile
495
496
  match(/^(800)/) >> split(3,3) | # Toll free
496
497
  match(/^(21[1-8])/) >> split(6) # Fixed
497
498
 
498
- # Madagascar
499
+ # Madagascar
499
500
  # https://en.wikipedia.org/wiki/Telephone_numbers_in_Madagascar
500
501
  # http://www.itu.int/oth/T020200007F/en
501
502
  country '261',
@@ -621,6 +621,12 @@ describe 'plausibility' do
621
621
  Phony.plausible?('+39 06 4991').should be_falsy
622
622
  Phony.plausible?('+39 06 49911').should be_truthy
623
623
  Phony.plausible?('+39 06 499112').should be_truthy
624
+
625
+ Phony.plausible?('+39 800 081631').should be_truthy
626
+ Phony.plausible?('+39 800 0816311').should be_falsy
627
+
628
+ Phony.plausible?('+39 803 08163').should be_falsy
629
+ Phony.plausible?('+39 803 081').should be_truthy
624
630
  end
625
631
 
626
632
  it 'is correct for Russia' 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.20.0
4
+ version: 2.20.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Hanke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-29 00:00:00.000000000 Z
11
+ date: 2023-01-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
@@ -115,26 +115,26 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  requirements: []
118
- rubygems_version: 3.0.3
118
+ rubygems_version: 3.3.26
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: Fast international phone number (E164 standard) normalizing, splitting and
122
122
  formatting.
123
123
  test_files:
124
- - spec/lib/phony_spec.rb
125
- - spec/lib/phony/trunk_code_spec.rb
126
- - spec/lib/phony/country_spec.rb
127
- - spec/lib/phony/national_code_spec.rb
124
+ - spec/functional/config_spec.rb
125
+ - spec/functional/plausibility_spec.rb
128
126
  - spec/lib/phony/countries_spec.rb
127
+ - spec/lib/phony/country_codes_spec.rb
128
+ - spec/lib/phony/country_spec.rb
129
129
  - spec/lib/phony/dsl_spec.rb
130
- - spec/lib/phony/national_splitters/variable_spec.rb
130
+ - spec/lib/phony/local_splitters/fixed_spec.rb
131
+ - spec/lib/phony/local_splitters/regex_spec.rb
132
+ - spec/lib/phony/national_code_spec.rb
133
+ - spec/lib/phony/national_splitters/default_spec.rb
134
+ - spec/lib/phony/national_splitters/fixed_spec.rb
131
135
  - spec/lib/phony/national_splitters/none_spec.rb
132
136
  - spec/lib/phony/national_splitters/regex_spec.rb
133
- - spec/lib/phony/national_splitters/fixed_spec.rb
134
- - spec/lib/phony/national_splitters/default_spec.rb
135
- - spec/lib/phony/country_codes_spec.rb
136
- - spec/lib/phony/local_splitters/regex_spec.rb
137
- - spec/lib/phony/local_splitters/fixed_spec.rb
137
+ - spec/lib/phony/national_splitters/variable_spec.rb
138
+ - spec/lib/phony/trunk_code_spec.rb
138
139
  - spec/lib/phony/vanity_spec.rb
139
- - spec/functional/config_spec.rb
140
- - spec/functional/plausibility_spec.rb
140
+ - spec/lib/phony_spec.rb