Module: Ubl

Defined in:
lib/ubl.rb,
lib/ubl/builder.rb,
lib/ubl/version.rb,
lib/ubl/validate.rb,
lib/ubl/constants.rb

Overview

Generate and validate UBL (Universal Business Language) documents, such as invoices and credit notes, compliant with the Peppol network.

Defined Under Namespace

Classes: CreditNote, Invoice, UblBuilder, Validator

Constant Summary collapse

VERSION =
"0.1.8"
CUSTOMIZATION_ID =
"urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0"
CUSTOMIZATION_UBL_BE =
"urn:cen.eu:en16931:2017#conformant#urn:UBL.BE:1.0.0.20180214"
PROFILE_ID =
"urn:fdc:peppol.eu:2017:poacc:billing:01:1.0"
UBL_BE =
"UBL_BE"

Class Method Summary collapse

Class Method Details

.validate_credit_note(path, extension: nil, schematron: true) ⇒ Object

Validate a credit note

Parameters

  • path - The path to the XML credit note that needs validation.

  • extension - Set to “UBL_BE” to generate UBL.BE compliant documents.

    Defaults to +nil+ for standard PEPPOL format.
    
  • schematron - If true, run a Schematron validation using Docker.

    Requires Docker to be installed and running. Defaults to +true+.
    


83
84
85
86
# File 'lib/ubl.rb', line 83

def self.validate_credit_note(path, extension: nil, schematron: true)
  validator = Validator.new(extension:, schematron:)
  validator.validate_credit_note(path)
end

.validate_invoice(path, extension: nil, schematron: true) ⇒ Object

Validate an invoice

Parameters

  • path - The path to the XML invoice that needs validation.

  • extension - Set to “UBL_BE” to generate UBL.BE compliant documents.

    Defaults to +nil+ for standard PEPPOL format.
    
  • schematron - If true, run a Schematron validation using Docker.

    Requires Docker to be installed and running. Defaults to +true+.
    


69
70
71
72
# File 'lib/ubl.rb', line 69

def self.validate_invoice(path, extension: nil, schematron: true)
  validator = Validator.new(extension:, schematron:)
  validator.validate_invoice(path)
end