Class: ACube::Schema::Header::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/acube/schema/header/header.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(supplier, customer) ⇒ Header

Returns a new instance of Header.



9
10
11
12
# File 'lib/acube/schema/header/header.rb', line 9

def initialize(supplier, customer)
  @supplier = supplier
  @customer = customer
end

Instance Attribute Details

#customerObject

Returns the value of attribute customer.



5
6
7
# File 'lib/acube/schema/header/header.rb', line 5

def customer
  @customer
end

#progressiveObject

Returns the value of attribute progressive.



7
8
9
# File 'lib/acube/schema/header/header.rb', line 7

def progressive
  @progressive
end

#supplierObject

Returns the value of attribute supplier.



5
6
7
# File 'lib/acube/schema/header/header.rb', line 5

def supplier
  @supplier
end

#transmission_formatObject

Returns the value of attribute transmission_format.



6
7
8
# File 'lib/acube/schema/header/header.rb', line 6

def transmission_format
  @transmission_format
end

Instance Method Details

#to_xmlObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/acube/schema/header/header.rb', line 14

def to_xml
  Nokogiri::XML::Builder.new do |xml|
    xml.FatturaElettronicaHeader {
      xml.DatiTrasmissione {
        xml.IdTrasmittente {
          xml.IdPaese ACube.transmission_nation_id
          xml.IdCodice ACube.transmission_id_code
        }

        xml.ProgressivoInvio progressive
        xml.FormatoTrasmissione transmission_format
        xml.CodiceDestinatario "0000000"
      }

      xml << supplier.to_xml
      xml << customer.to_xml
    }
  end.to_xml(save_with: 2)
end