worldwide 1.14.4 → 1.15.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: 38658a0cbe2fcec35aa5d8d620d9cac02ada5123597d8080733904c0dd371483
4
- data.tar.gz: '08b4a6578e559996a928c9ae3600b5b48e806c5ca5e97478d5258aefb4263288'
3
+ metadata.gz: d10d81c9b857f86106cd5bd152abbe999ca045435d904a932eb8f3df69a52293
4
+ data.tar.gz: 7a2fa0a560b361db7ab472c6cc5676c9dd68518dc6fe49fe3b1c98f3dea1b98f
5
5
  SHA512:
6
- metadata.gz: 9dcf39bb1680898cacc8da3ac4c07f89edcec9c090c4aba0b3c66040d91ed4042e349cbbab64dd7f4f0971aea325dc57a465ea673be154d175786664a85990f9
7
- data.tar.gz: c1d8df6382fa989b8c0f1dc710c85f14b4f7e2968c81d26d361038090ca95d812e1c09e46a798114bef33fcd839dcc01955ce4f0ba35801a60ba8e323e55760b
6
+ metadata.gz: e672163556eacb4fcdbbdef8859242fdd26f8575ed6c4d9c0c24fe16938b06d6c8e125fb2c8876f36829efe08ec3f09bbe78e8a3aab0d3ea763708f26c3422e7
7
+ data.tar.gz: 7dda9172548c84533eb716b1c84fb26bf6383d5b31afc69da71efe7128b34a7ac72cfbc2b9231e9ebc415e57e91bf975067f28ae2a48d5186ffd883c8f29c4ad
data/CHANGELOG.md CHANGED
@@ -28,8 +28,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
28
28
  ## [Unreleased]
29
29
 
30
30
  Nil.
31
+
31
32
  ---
32
33
 
34
+ ## [1.15.0] - 2024-12-16
35
+ - Add zip requirement and tax inclusive methods to country regions [#320](https://github.com/Shopify/worldwide/pull/320)
36
+ - Set Ireland (IE) zip as a required address field [#321](https://github.com/Shopify/worldwide/pull/321)
37
+
33
38
  ## [1.14.4] - 2024-12-12
34
39
  - Speed up configure_i18n by precomputing paths and indexing descendants [#316](https://github.com/Shopify/worldwide/pull/316)
35
40
  - Update BV phone number prefix to 47 (Norway) [#318](https://github.com/Shopify/worldwide/pull/318)
data/Gemfile.lock CHANGED
@@ -13,7 +13,7 @@ GIT
13
13
  PATH
14
14
  remote: .
15
15
  specs:
16
- worldwide (1.14.4)
16
+ worldwide (1.15.0)
17
17
  activesupport (>= 7.0)
18
18
  i18n
19
19
  phonelib (~> 0.8)
data/data/regions/IE.yml CHANGED
@@ -13,7 +13,6 @@ tags:
13
13
  zip_regex: "^(D6W|[AC-FHKNPRT-Z]\\d{2}) ?[0-9AC-FHKNPRT-Z]{4}$"
14
14
  partial_zip_regex: "^(D6W|[AC-FHKNPRT-Z]\\d{2})$"
15
15
  zip_example: A65 F4E2
16
- zip_requirement: recommended
17
16
  phone_number_prefix: 353
18
17
  week_start_day: monday
19
18
  format:
@@ -163,6 +163,9 @@ module Worldwide
163
163
  # Note that this should really be translated; showing this untranslated name to users is a bad idea.
164
164
  attr_reader :tax_name
165
165
 
166
+ # Whether the region uses tax-inclusive pricing.
167
+ attr_accessor :tax_inclusive
168
+
166
169
  # "generic" VAT tax rate on "most" goods
167
170
  attr_reader :tax_rate
168
171
 
@@ -198,7 +201,7 @@ module Worldwide
198
201
  attr_accessor :zip_example
199
202
 
200
203
  # Is a zip value required in this region? (Possible values: "optional", "recommended", "required")
201
- attr_accessor :zip_requirement
204
+ attr_writer :zip_requirement
202
205
 
203
206
  # A list of character sequences with which a postal code in this region may start.
204
207
  attr_accessor :zip_prefixes
@@ -276,6 +279,7 @@ module Worldwide
276
279
  @partial_zip_regex = nil
277
280
  @phone_number_prefix = nil
278
281
  @tags = []
282
+ @tax_inclusive = false
279
283
  @timezone = nil
280
284
  @timezones = {}
281
285
  @unit_system = nil
@@ -435,13 +439,23 @@ module Worldwide
435
439
 
436
440
  # is a postal code required for this region?
437
441
  def zip_required?
438
- if zip_requirement.nil?
442
+ if @zip_requirement.nil?
439
443
  !zip_regex.nil?
440
444
  else
441
- REQUIRED == zip_requirement
445
+ REQUIRED == @zip_requirement
442
446
  end
443
447
  end
444
448
 
449
+ # Returns whether (and how firmly) we require a value in the zip field
450
+ # Possible returns:
451
+ # - "required" means a value must be supplied
452
+ # - "recommended" means a value is optional, but we recommend providing one
453
+ # - "optional" means a value is optional, and we say it is optional
454
+ # @return [String]
455
+ def zip_requirement
456
+ @zip_requirement || (zip_required? ? REQUIRED : OPTIONAL)
457
+ end
458
+
445
459
  # is a neighborhood required for this region?
446
460
  def neighborhood_required?
447
461
  additional_field_required?("neighborhood")
@@ -114,6 +114,7 @@ module Worldwide
114
114
  region.partial_zip_regex = spec["partial_zip_regex"]
115
115
  region.phone_number_prefix = spec["phone_number_prefix"]
116
116
  region.tags = spec["tags"] || []
117
+ region.tax_inclusive = spec["tax_inclusive"] || false
117
118
  region.timezone = spec["timezone"]
118
119
  region.timezones = spec["timezones"] || {}
119
120
  region.week_start_day = spec["week_start_day"] || "sunday"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Worldwide
4
- VERSION = "1.14.4"
4
+ VERSION = "1.15.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: worldwide
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.4
4
+ version: 1.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-12 00:00:00.000000000 Z
11
+ date: 2024-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport