Class: Ticketbai::Documents::IssuanceUnsigned
- Inherits:
-
Object
- Object
- Ticketbai::Documents::IssuanceUnsigned
- Defined in:
- lib/ticketbai/documents/issuance_unsigned.rb
Overview
This document has the pecualiarity that it does not need to be signed and it must be sent to the API without a root node, so it’s not considered as a valid XML either. The structure of the document is as follows: <Destinatarios> … … </Destinatarios> <CabeceraFactura> … … </CabeceraFactura> <DatosFactura>
...
...
</DatosFactura> <TipoDesglose> … … </TipoDesglose>
The document is created with a temporary root node (TicketBai), and after creating it, it’s returned without the root node.
Instance Method Summary collapse
- #create ⇒ String
-
#initialize(**args) ⇒ IssuanceUnsigned
constructor
A new instance of IssuanceUnsigned.
Constructor Details
#initialize(**args) ⇒ IssuanceUnsigned
Returns a new instance of IssuanceUnsigned.
30 31 32 33 34 35 |
# File 'lib/ticketbai/documents/issuance_unsigned.rb', line 30 def initialize(**args) @receiver = args[:receiver] @invoice_header = args[:invoice_header] @invoice_data = args[:invoice_data] @breakdown_type = args[:breakdown_type] end |
Instance Method Details
#create ⇒ String
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ticketbai/documents/issuance_unsigned.rb', line 38 def create builder = Nokogiri::XML::Builder.new(encoding: Encoding::UTF_8.to_s) do |xml| xml.TicketBai do @receiver&.build_xml(xml) @invoice_header.build_xml(xml) @invoice_data.build_xml(xml) @breakdown_type.build_xml(xml) end end filter_root_node(builder) end |