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 +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/belpost/validations/batch_item_schema.rb +23 -0
- data/lib/belpost/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9514e803064862ca1a9922d89527d3a97da9806105b3621d6c844405a8ee517d
|
4
|
+
data.tar.gz: '0274388346a6da307d7d27ccf1420893e35deb74d860a35a9bffc2e630f8f7a1'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
data/lib/belpost/version.rb
CHANGED