Class: ZATCA::UBL::CommonAggregateComponents::ClassifiedTaxCategory

Inherits:
BaseComponent
  • Object
show all
Defined in:
lib/zatca/ubl/common_aggregate_components/classified_tax_category.rb

Constant Summary

Constants inherited from BaseComponent

BaseComponent::ArrayOfBaseComponentOrNil

Instance Attribute Summary collapse

Attributes inherited from BaseComponent

#attributes, #index, #value

Instance Method Summary collapse

Methods inherited from BaseComponent

#[], build, #build_xml, #dig, #find_nested_element_by_path, #generate_xml, #schema, #to_h, #to_xml

Constructor Details

#initialize(id: "S", percent: "15.00", tax_scheme_id: "VAT") ⇒ ClassifiedTaxCategory

Returns a new instance of ClassifiedTaxCategory.



4
5
6
7
8
9
10
# File 'lib/zatca/ubl/common_aggregate_components/classified_tax_category.rb', line 4

def initialize(id: "S", percent: "15.00", tax_scheme_id: "VAT")
  super()

  @id = id
  @percent = percent
  @tax_scheme_id = tax_scheme_id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



2
3
4
# File 'lib/zatca/ubl/common_aggregate_components/classified_tax_category.rb', line 2

def id
  @id
end

#scheme_idObject (readonly)

Returns the value of attribute scheme_id.



2
3
4
# File 'lib/zatca/ubl/common_aggregate_components/classified_tax_category.rb', line 2

def scheme_id
  @scheme_id
end

Instance Method Details

#elementsObject



16
17
18
19
20
21
22
23
24
# File 'lib/zatca/ubl/common_aggregate_components/classified_tax_category.rb', line 16

def elements
  [
    ZATCA::UBL::BaseComponent.new(name: "cbc:ID", value: @id),
    ZATCA::UBL::BaseComponent.new(name: "cbc:Percent", value: @percent),
    ZATCA::UBL::BaseComponent.new(name: "cac:TaxScheme", elements: [
      ZATCA::UBL::BaseComponent.new(name: "cbc:ID", value: @tax_scheme_id)
    ])
  ]
end

#nameObject



12
13
14
# File 'lib/zatca/ubl/common_aggregate_components/classified_tax_category.rb', line 12

def name
  "cac:ClassifiedTaxCategory"
end