Class: ZATCA::UBL::CommonAggregateComponents::Item

Inherits:
BaseComponent
  • Object
show all
Defined in:
lib/zatca/ubl/common_aggregate_components/item.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(name:, classified_tax_category: nil) ⇒ Item

Returns a new instance of Item.



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

def initialize(name:, classified_tax_category: nil)
  super()

  @name = name
  @classified_tax_category = classified_tax_category || ZATCA::UBL::CommonAggregateComponents::ClassifiedTaxCategory.new
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



2
3
4
# File 'lib/zatca/ubl/common_aggregate_components/item.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/item.rb', line 2

def scheme_id
  @scheme_id
end

Instance Method Details

#elementsObject



15
16
17
18
19
20
# File 'lib/zatca/ubl/common_aggregate_components/item.rb', line 15

def elements
  [
    ZATCA::UBL::BaseComponent.new(name: "cbc:Name", value: @name),
    @classified_tax_category
  ]
end

#nameObject



11
12
13
# File 'lib/zatca/ubl/common_aggregate_components/item.rb', line 11

def name
  "cac:Item"
end