Class: Ksef::UPO::Validation
- Inherits:
-
Data
- Object
- Data
- Ksef::UPO::Validation
- Defined in:
- lib/ksef/upo/validation.rb
Overview
The outcome of checking a UPO against the bundled schema (docs/REFERENCE.md §14.3).
Two lists rather than one, because a UPO has a category of schema violation that is
upstream's fault and expected: upo-v4-3.xsd fixes the receiving party's name to
"Ministerstwo Finansów", while every non-production environment appends a marker. All
six of upstream's own worked examples fail upstream's own schema on exactly that
element, and nothing else.
So those go in #warnings and everything else in #errors, and #valid? ignores the warnings. A validator that reported them as errors would reject every UPO that TEST and DEMO issue — which is the trap this gem would otherwise have walked into, having already built strict XSD validation for FA(3).
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#receiving_party ⇒ Object
readonly
Returns the value of attribute receiving_party.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
-
#clean? ⇒ Boolean
True when the document also matched the
fixedvalue — which in practice means it came from production, or from an environment that has stopped appending a marker. -
#environment_marked? ⇒ Boolean
True when the only complaint was the known upstream defect.
- #messages ⇒ Object
- #to_s ⇒ Object
-
#valid? ⇒ Boolean
True when nothing but the expected environment-marker discrepancy was found.
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors
17 18 19 |
# File 'lib/ksef/upo/validation.rb', line 17 def errors @errors end |
#receiving_party ⇒ Object (readonly)
Returns the value of attribute receiving_party
17 18 19 |
# File 'lib/ksef/upo/validation.rb', line 17 def receiving_party @receiving_party end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings
17 18 19 |
# File 'lib/ksef/upo/validation.rb', line 17 def warnings @warnings end |
Instance Method Details
#clean? ⇒ Boolean
True when the document also matched the fixed value — which in practice means it
came from production, or from an environment that has stopped appending a marker.
23 |
# File 'lib/ksef/upo/validation.rb', line 23 def clean? = errors.empty? && warnings.empty? |
#environment_marked? ⇒ Boolean
True when the only complaint was the known upstream defect.
26 |
# File 'lib/ksef/upo/validation.rb', line 26 def environment_marked? = errors.empty? && !warnings.empty? |
#messages ⇒ Object
28 |
# File 'lib/ksef/upo/validation.rb', line 28 def = errors + warnings |
#to_s ⇒ Object
30 31 32 33 34 |
# File 'lib/ksef/upo/validation.rb', line 30 def to_s return "valid" if clean? "#{errors.size} error(s), #{warnings.size} warning(s)" end |
#valid? ⇒ Boolean
True when nothing but the expected environment-marker discrepancy was found.
19 |
# File 'lib/ksef/upo/validation.rb', line 19 def valid? = errors.empty? |