Class: Xrechnung::Item

Inherits:
Object
  • Object
show all
Includes:
MemberContainer
Defined in:
lib/xrechnung/item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MemberContainer

#[], #[]=, included, #initialize

Instance Attribute Details

#buyers_item_identification_idXrechnung::Id

Returns:



19
# File 'lib/xrechnung/item.rb', line 19

member :buyers_item_identification_id, type: Xrechnung::Id, optional: true

#classified_tax_categoryXrechnung::TaxCategory



31
# File 'lib/xrechnung/item.rb', line 31

member :classified_tax_category, type: Xrechnung::TaxCategory

#commodity_classificationXrechnung::TaxCategory



27
# File 'lib/xrechnung/item.rb', line 27

member :commodity_classification, type: Xrechnung::TaxCategory

#descriptionString

Returns:

  • (String)


7
# File 'lib/xrechnung/item.rb', line 7

member :description, type: String

#nameString

Returns:

  • (String)


11
# File 'lib/xrechnung/item.rb', line 11

member :name, type: String

#sellers_item_identification_idXrechnung::Id

Returns:



23
# File 'lib/xrechnung/item.rb', line 23

member :sellers_item_identification_id, type: Xrechnung::Id, optional: true

#standard_item_identification_idXrechnung::Id

Returns:



15
# File 'lib/xrechnung/item.rb', line 15

member :standard_item_identification_id, type: Xrechnung::Id, optional: true

Instance Method Details

#to_xml(xml) ⇒ Object

noinspection RubyResolve



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/xrechnung/item.rb', line 34

def to_xml(xml) # rubocop:disable Metrics
  xml.cac :Item do
    xml.cbc :Description, description
    xml.cbc :Name, name

    unless standard_item_identification_id.nil?
      xml.cac :StandardItemIdentification do
        xml.cbc :ID, standard_item_identification_id.id, schemeID: standard_item_identification_id.scheme_id
      end
    end

    unless buyers_item_identification_id.nil?
      xml.cac :BuyersItemIdentification do
        xml.cbc :ID, buyers_item_identification_id.id
      end
    end

    unless sellers_item_identification_id.nil?
      xml.cac :SellersItemIdentification do
        xml.cbc :ID, sellers_item_identification_id.id
      end
    end

    xml.cac :CommodityClassification, commodity_classification unless commodity_classification.nil?

    classified_tax_category&.to_xml(xml, root_tag_name: :ClassifiedTaxCategory)
  end
end