belpost 0.11.0 → 0.11.1

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: 43a87cdb950f04f9508bd0facb45918b68d17fc2442f6dd6ef9a0698e350950d
4
- data.tar.gz: 24fe3c8cbde4d7ddc4e5cd5d21f03a6f9001c5820fdad7fcea0dcb06013c5909
3
+ metadata.gz: 9514e803064862ca1a9922d89527d3a97da9806105b3621d6c844405a8ee517d
4
+ data.tar.gz: '0274388346a6da307d7d27ccf1420893e35deb74d860a35a9bffc2e630f8f7a1'
5
5
  SHA512:
6
- metadata.gz: 8a90de8d13d830d5eb68b0fbbfa9374495f699cd66932b4c2d6e422348a494e6f9f4b46d30b3e8444f50e7d73fc28175cc1fe78036927b878a14c95108131dd1
7
- data.tar.gz: c9bedc78bd654b6624ee3f20b7e292e78c4a0de11ed957763c367d7eadcd3ca719a65f4f2a805b2b1a8951d9afac621a05f97a5864cfc805d2161193d00f5e31
6
+ metadata.gz: 522b879eb66e52848f47c987195d801ee62b59ceb86d3cc54211287bf87b85452649413c4754623b5aba4ae1b463b3c6f17befef452c3b5720be4cc08083c550
7
+ data.tar.gz: 74a86bddb8eed2b813ddc73f1d0f1fc2bd9c6b00737cdf680060af06e0b38415abbe9fc0b8e4b600f36f4a885c1dfd0552d9d53ad4317da647202d9b24602a99
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [0.11.1] - 2025-04-24
2
+ ### Changed
3
+ - Enhanced validation for batch item schema to allow empty strings for `cash_on_delivery` and `declared_value` fields
4
+ - Improved flexibility in the validation of numeric fields to support both positive numeric values and empty strings
5
+
1
6
  ## [0.11.0] - 2025-04-23
2
7
  ### Added
3
8
  - Added support for finding addresses by postal code via `find_addresses_by_postcode` method
@@ -154,6 +154,29 @@ module Belpost
154
154
  end
155
155
  end
156
156
 
157
+ # Custom validation for cash_on_delivery and declared_value
158
+ rule('items[].addons.cash_on_delivery') do
159
+ if key? && value.is_a?(Array)
160
+ value.each_with_index do |item, idx|
161
+ if item[:addons] && item[:addons][:cash_on_delivery] == ""
162
+ # Allow empty string by manually succeeding the validation
163
+ key(:"items.#{idx}.addons.cash_on_delivery").success("")
164
+ end
165
+ end
166
+ end
167
+ end
168
+
169
+ rule('items[].addons.declared_value') do
170
+ if key? && value.is_a?(Array)
171
+ value.each_with_index do |item, idx|
172
+ if item[:addons] && item[:addons][:declared_value] == ""
173
+ # Allow empty string by manually succeeding the validation
174
+ key(:"items.#{idx}.addons.declared_value").success("")
175
+ end
176
+ end
177
+ end
178
+ end
179
+
157
180
  # Add class method to make it callable directly
158
181
  def self.call(params)
159
182
  new.call(params)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Belpost
4
- VERSION = "0.11.0"
4
+ VERSION = "0.11.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: belpost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - KuberLite