Class: FacturX::Document
- Inherits:
-
Object
- Object
- FacturX::Document
- Defined in:
- lib/factur_x/document.rb
Overview
Serialises an Invoice to Cross Industry Invoice XML.
Every complex type in the CII schema is an xs:sequence, so the order in which the emit_* methods write their children is significant and mirrors the XSD. Ordering mistakes surface as schema violations in the test suite.
Constant Summary collapse
- RSM =
"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"- RAM =
"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"- QDT =
"urn:un:unece:uncefact:data:standard:QualifiedDataType:100"- UDT =
"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"- XSI =
"http://www.w3.org/2001/XMLSchema-instance"- NAMESPACES =
{ "xmlns:rsm" => RSM, "xmlns:qdt" => QDT, "xmlns:ram" => RAM, "xmlns:udt" => UDT, "xmlns:xsi" => XSI }.freeze
Instance Method Summary collapse
-
#initialize(invoice) ⇒ Document
constructor
A new instance of Document.
- #to_document ⇒ Object
- #to_xml(indent: 2) ⇒ Object
Constructor Details
#initialize(invoice) ⇒ Document
Returns a new instance of Document.
29 30 31 |
# File 'lib/factur_x/document.rb', line 29 def initialize(invoice) @invoice = invoice end |
Instance Method Details
#to_document ⇒ Object
37 38 39 |
# File 'lib/factur_x/document.rb', line 37 def to_document @to_document ||= build end |
#to_xml(indent: 2) ⇒ Object
33 34 35 |
# File 'lib/factur_x/document.rb', line 33 def to_xml(indent: 2) to_document.to_xml(indent: indent, encoding: "UTF-8") end |