Class: Ticketbai::Nodes::InvoiceHeader

Inherits:
Object
  • Object
show all
Defined in:
lib/ticketbai/nodes/invoice_header.rb

Constant Summary collapse

SIMPLIFIED_INVOICE =
'S'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ InvoiceHeader

Returns a new instance of InvoiceHeader.



6
7
8
9
10
11
12
# File 'lib/ticketbai/nodes/invoice_header.rb', line 6

def initialize(args = {})
  @invoice_serial = args[:invoice_serial]
  @invoice_number = args[:invoice_number]
  @invoice_date = args[:invoice_date]
  @invoice_time = args[:invoice_time]
  @simplified_invoice = args[:simplified_invoice]
end

Instance Method Details

#build_xml(node) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/ticketbai/nodes/invoice_header.rb', line 14

def build_xml(node)
  node = Nokogiri::XML::Builder.new if node.nil?
  node.CabeceraFactura do |xml|
    xml.SerieFactura @invoice_serial
    xml.NumFactura @invoice_number
    xml.FechaExpedicionFactura @invoice_date
    xml.HoraExpedicionFactura @invoice_time if @invoice_time
    xml.FacturaSimplificada SIMPLIFIED_INVOICE if @simplified_invoice
  end
end