worldwide 1.16.0 → 1.17.0

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: 3ae35c7fef387a7a8bd96da08b0c866c8523fb0822de59aed5a9f7e46ebb1d1c
4
- data.tar.gz: bea0470154cf31dd70749fe41b49523bc6199ba0a1bc645731d16f9720090ccb
3
+ metadata.gz: 98e884c554e9fc6747f711663397b332c33134d41668ee531bd454eaa3b8933b
4
+ data.tar.gz: d2f97e0e3ccf829ebec0accbb8d0b0e33ecc74e3717c078912348c22e451c43b
5
5
  SHA512:
6
- metadata.gz: 4d80bda33704f535981d8dcda6ee9babbdd34dfc8b5e3bc4e5cd58cbf59d9a09f8231c0397683706966e80f20e24f83026c05e5c72168dfa1846de2ac505b222
7
- data.tar.gz: c0bad66b5445db6d4854fae872e8bc9029786befa99df83e41a52fcbb7b673b6dc053ff2ee89c3331fcff691539e1e0654298109975da6a1aa795215f9ecd845
6
+ metadata.gz: c6d7640f1bdc048229a93455df95d484e42115a06abab71dfb3ded9e833c155a94b12b80ba86444872297faaabe9604e345c6c97b36531a970a4f33cfe9d4368
7
+ data.tar.gz: a57338f91418e3751ff55b392223eb7404df16f84cd7edc3ee8505873e92b0fe36f611c6ffa59f8a3b9f78b3884ed27f7c30a9d9031b3985d30a7a93815f03e9
data/CHANGELOG.md CHANGED
@@ -27,9 +27,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
27
27
 
28
28
  ## [Unreleased]
29
29
 
30
- Nil.
31
30
  ---
32
31
 
32
+ ## [1.17.0] - 2025-02-27
33
+ - Add has_cities? method to regions [#331](https://github.com/Shopify/worldwide/pull/331)
34
+ - Update known zip prefixes for Portugal (PT) [#332]https://github.com/Shopify/worldwide/pull/332
35
+ - Allow zone lookup by partial zip if country hides provinces [#332]https://github.com/Shopify/worldwide/pull/332
36
+ - Add `has_zip_prefixes?` and `neighbors` methods to Region [#332]https://github.com/Shopify/worldwide/pull/332
37
+
33
38
  ## [1.16.0] - 2025-02-17
34
39
  - Add `ignore_provinces` to regions [#329](https://github.com/Shopify/worldwide/pull/329)
35
40
 
data/Gemfile.lock CHANGED
@@ -13,7 +13,7 @@ GIT
13
13
  PATH
14
14
  remote: .
15
15
  specs:
16
- worldwide (1.16.0)
16
+ worldwide (1.17.0)
17
17
  activesupport (>= 7.0)
18
18
  i18n
19
19
  phonelib (~> 0.8)
data/data/regions/PT.yml CHANGED
@@ -112,11 +112,14 @@ zones:
112
112
  - '472'
113
113
  - '473'
114
114
  - '4740'
115
+ - '4741'
115
116
  - '475'
116
117
  - '476'
117
118
  - '477'
118
119
  - '480'
119
120
  - '4810'
121
+ - '4811'
122
+ - '4813'
120
123
  - '4814'
121
124
  - 4815-0
122
125
  - 4815-1
@@ -143,7 +146,11 @@ zones:
143
146
  - 4815-69
144
147
  - 4815-7
145
148
  - 4815-9
149
+ - '4816'
150
+ - '4817'
146
151
  - '4820'
152
+ - '4821'
153
+ - '4823'
147
154
  - '4824'
148
155
  - '483'
149
156
  - '484'
@@ -214,6 +221,7 @@ zones:
214
221
  - 6250-16
215
222
  - 6250-17
216
223
  - 6250-9
224
+ - '6251'
217
225
  - 6320-19
218
226
  - name: Coimbra
219
227
  code: PT-06
@@ -243,7 +251,10 @@ zones:
243
251
  - 3020-79
244
252
  - 3020-8
245
253
  - 3020-9
254
+ - '3021'
246
255
  - '3025'
256
+ - '3026'
257
+ - '3027'
247
258
  - '303'
248
259
  - '304'
249
260
  - '306'
@@ -326,6 +337,7 @@ zones:
326
337
  - 6320-6
327
338
  - 6320-7
328
339
  - 6320-9
340
+ - '6321'
329
341
  - '6324'
330
342
  - '635'
331
343
  - '636'
@@ -341,6 +353,8 @@ zones:
341
353
  - '241'
342
354
  - '242'
343
355
  - '2430'
356
+ - '2431'
357
+ - '2433'
344
358
  - '2434'
345
359
  - '244'
346
360
  - '245'
@@ -351,6 +365,7 @@ zones:
351
365
  - 2495-1
352
366
  - 2495-2
353
367
  - 2495-998
368
+ - 2496-907
354
369
  - '2499'
355
370
  - '250'
356
371
  - '251'
@@ -433,6 +448,8 @@ zones:
433
448
  - '459'
434
449
  - '460'
435
450
  - '4610'
451
+ - '4611'
452
+ - '4613'
436
453
  - '4614'
437
454
  - 4615-0
438
455
  - 4615-1
@@ -443,6 +460,7 @@ zones:
443
460
  - 4615-6
444
461
  - 4615-7
445
462
  - 4615-9
463
+ - '4616'
446
464
  - 4620-007
447
465
  - 4620-008
448
466
  - 4620-009
@@ -572,12 +590,14 @@ zones:
572
590
  - 4620-7
573
591
  - 4620-8
574
592
  - 4620-9
593
+ - '4621'
575
594
  - '4624'
576
595
  - '4625'
577
596
  - '463'
578
597
  - '464'
579
598
  - '465'
580
599
  - '4745'
600
+ - '4746'
581
601
  - '478'
582
602
  - '479'
583
603
  - 4815-621
@@ -607,6 +627,8 @@ zones:
607
627
  - 2100-5
608
628
  - 2100-6
609
629
  - 2100-9
630
+ - '2101'
631
+ - '2103'
610
632
  - '212'
611
633
  - '213'
612
634
  - '214'
@@ -614,12 +636,15 @@ zones:
614
636
  - '22'
615
637
  - '23'
616
638
  - '2435'
639
+ - '2436'
617
640
  - '2490'
641
+ - '2494'
618
642
  - 2495-3
619
643
  - 2495-4
620
644
  - 2495-5
621
645
  - 2495-6
622
646
  - 2495-999
647
+ - 2496-908
623
648
  - 2890-40
624
649
  - '612'
625
650
  - name: Setúbal
@@ -646,7 +671,10 @@ zones:
646
671
  - 2890-5
647
672
  - 2890-7
648
673
  - 2890-9
674
+ - '2891'
675
+ - '2893'
649
676
  - '2894'
677
+ - '2896'
650
678
  - '290'
651
679
  - '291'
652
680
  - '292'
@@ -668,6 +696,7 @@ zones:
668
696
  zip_prefixes:
669
697
  - '4900'
670
698
  - '4901'
699
+ - '4903'
671
700
  - '4904'
672
701
  - 4905-044
673
702
  - 4905-045
@@ -689,6 +718,7 @@ zones:
689
718
  - 4905-5
690
719
  - 4905-6
691
720
  - 4905-9
721
+ - '4906'
692
722
  - '491'
693
723
  - '492'
694
724
  - '493'
@@ -714,6 +744,7 @@ zones:
714
744
  - 5040-4
715
745
  - 5040-5
716
746
  - 5040-9
747
+ - '5041'
717
748
  - '505'
718
749
  - '506'
719
750
  - '507'
@@ -746,6 +777,7 @@ zones:
746
777
  - 3640-2
747
778
  - 3640-3
748
779
  - 3640-9
780
+ - '3641'
749
781
  - '365'
750
782
  - '366'
751
783
  - '367'
@@ -143,6 +143,8 @@ module Worldwide
143
143
  # E.g., for CA-ON, the neighbouring zones are CA-MB, CA-NU and CA-QC.
144
144
  attr_accessor :neighbours
145
145
 
146
+ alias_method :neighbors, :neighbours
147
+
146
148
  # The ISO-3166-1 three-digit code for this region (returned as a string to preserve
147
149
  # leading zeroes), e.g., "003".
148
150
  attr_reader :numeric_three
@@ -387,6 +389,11 @@ module Worldwide
387
389
  !!format["show"]&.include?("{zip}")
388
390
  end
389
391
 
392
+ # Does this region have cities?
393
+ def has_cities?
394
+ !!format["show"]&.include?("{city}")
395
+ end
396
+
390
397
  # Is this Region considered a "province" (political subdivision of a "country")?
391
398
  def province?
392
399
  @province
@@ -431,7 +438,10 @@ module Worldwide
431
438
  search_name == I18n.with_locale(:en) { region.full_name&.upcase }
432
439
  end
433
440
  else # Worldwide::Util.present?(zip)
434
- zone_by_normalized_zip(Zip.normalize(country_code: iso_code, zip: zip))
441
+ zone_by_normalized_zip(
442
+ Zip.normalize(country_code: iso_code, zip: zip),
443
+ allow_partial_zip: hide_provinces_from_addresses,
444
+ )
435
445
  end || Worldwide.unknown_region
436
446
  end
437
447
 
@@ -489,6 +499,13 @@ module Worldwide
489
499
  province_optional || !@zones&.any?(&:province?)
490
500
  end
491
501
 
502
+ # Returns true if this country has zones defined, and has postal code prefix data for the zones
503
+ def has_zip_prefixes?
504
+ @zones&.any? do |zone|
505
+ Util.present?(zone.zip_prefixes)
506
+ end
507
+ end
508
+
492
509
  private
493
510
 
494
511
  def add_zone_to_hash(zone)
@@ -535,13 +552,6 @@ module Worldwide
535
552
  false
536
553
  end
537
554
 
538
- # Returns true if this country has zones defined, and has postal code prefix data for the zones
539
- def has_zip_prefixes?
540
- @zones&.any? do |zone|
541
- Util.present?(zone.zip_prefixes)
542
- end
543
- end
544
-
545
555
  def inspected_fields
546
556
  INSPECTION_FIELDS.map { |field_name| "@#{field_name}=#{send(field_name).inspect}" }.join(", ")
547
557
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Worldwide
4
- VERSION = "1.16.0"
4
+ VERSION = "1.17.0"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: worldwide
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.0
4
+ version: 1.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-02-18 00:00:00.000000000 Z
10
+ date: 2025-02-27 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activesupport