Class: ZATCA::UBL::CommonAggregateComponents::PartyIdentification

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

Constant Summary collapse

SCHEMA =
Dry::Schema.Params do
  required(:id).filled(:string)
  required(:scheme_id).filled(:string)
end

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:, scheme_id: "CRN") ⇒ PartyIdentification

Returns a new instance of PartyIdentification.



9
10
11
12
13
14
# File 'lib/zatca/ubl/common_aggregate_components/party_identification.rb', line 9

def initialize(id:, scheme_id: "CRN")
  super()

  @id = id
  @scheme_id = scheme_id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



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

def scheme_id
  @scheme_id
end

Instance Method Details

#elementsObject



20
21
22
23
24
# File 'lib/zatca/ubl/common_aggregate_components/party_identification.rb', line 20

def elements
  [
    ZATCA::UBL::BaseComponent.new(name: "cbc:ID", value: @id, attributes: {"schemeID" => @scheme_id})
  ]
end

#nameObject



16
17
18
# File 'lib/zatca/ubl/common_aggregate_components/party_identification.rb', line 16

def name
  "cac:PartyIdentification"
end