Class: BuhoCfdi::XmlProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/buho_cfdi.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ XmlProcessor

Returns a new instance of XmlProcessor.



31
32
33
34
35
# File 'lib/buho_cfdi.rb', line 31

def initialize(params)
  @strategy = XML_BUILDING_STRATEGY

  @receipt = BuhoCfdi::ParamsBuilder.new(params).receipt
end

Instance Attribute Details

#cfdiObject

Returns the value of attribute cfdi.



29
30
31
# File 'lib/buho_cfdi.rb', line 29

def cfdi
  @cfdi
end

#receiptObject

Returns the value of attribute receipt.



29
30
31
# File 'lib/buho_cfdi.rb', line 29

def receipt
  @receipt
end

#strategyObject

Returns the value of attribute strategy.



29
30
31
# File 'lib/buho_cfdi.rb', line 29

def strategy
  @strategy
end

Instance Method Details

#process_xmlObject



37
38
39
40
41
42
43
44
45
# File 'lib/buho_cfdi.rb', line 37

def process_xml
  @cfdi = strategy.call(receipt)

  # file = File.new('xml_example.xml', 'w+')
  # file.write(cfdi.to_xml)
  # file.close

  cfdi
end