Class: DtefacilXmlBuilder::TestDocuments

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

Instance Method Summary collapse

Instance Method Details

#read_collectionObject



19
20
21
22
23
# File 'lib/dtefacil_xml_builder/test_documents.rb', line 19

def read_collection
  response = RestClient.get "https://ptoTicket:[email protected]/1.2/documentos"
  reader = DteCollectionReader.new
  reader.collection= response.body
end

#read_dteObject



12
13
14
15
16
17
# File 'lib/dtefacil_xml_builder/test_documents.rb', line 12

def read_dte
  response = RestClient.get "https://acid:[email protected]/1.2/documentos/d3g3zty5qybgx3e5dcqls22iuwy"
  reader = DteReader.new
  reader.dte= response.body
  reader.monto
end

#read_erroresObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/dtefacil_xml_builder/test_documents.rb', line 25

def read_errores
  begin
    response = RestClient.get "https://api.dtefacil.cl/1.2/documentos"  
  rescue Exception => e
    er = Errores.new
    er.errores= e.response
    er.error        
  end
  
  
end

#set_factura_electronica_with_hashObject



4
5
6
7
8
9
10
# File 'lib/dtefacil_xml_builder/test_documents.rb', line 4

def set_factura_electronica_with_hash
  receptor = { :rut => "15842089-9", :razon_social => "Vladimir", :giro => "Computacion", :direccion => "Alameda", :comuna => "Santiago", :ciudad => "Satiago" }
  detalles = [{:nombre => "Pelota", :cantidad => 3, :precio_unitario => 45}] 
  f = FacturaElectronica.new
  f.set_invoice [324], receptor, detalles
  f.render_xml
end