facturas_xml 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50732239f03310eecc29e070bb84df72cf32870e380a33c9880bdcd57440e259
4
- data.tar.gz: 3ff6de694642620ecee0bb2970ba6fc7b2c9cc27dfb8941338074deeed7b2223
3
+ metadata.gz: 911582cfe2fee59a066adeb5e308b1fae2cf993353a454aa9f007117bc927831
4
+ data.tar.gz: a8b6ce28566e0cee60889274586b98688fdcca1460719bf5e83ad4a63cf90836
5
5
  SHA512:
6
- metadata.gz: e2720120a9660a320a879c68d75ea8b192f9aa129e892e2071769d205614605501f153ab65a2e10c064dd48182fc2633e6f0ace5a3d713dec552daf4639f606a
7
- data.tar.gz: fa08b203a2992bfb6b602f51bd480bb0d36be4a16bbe73dc64a881857da6ecfa12936ecf044d8aafa40b2ba64979fc29bb45c4c145aa3ae56b9df210555b6e43
6
+ metadata.gz: a9bbd95126e8bf523735526f6b34b105df353638ad18e1a236e1e2355337426746772ea31518d030fd2456791348b4bbc2efe5953463ab670dd4c12719f9b069
7
+ data.tar.gz: e6aa97fac48113439fc994b5757125b3ac04cd84af9074faaf3c6b6e632d01f32fc3c7f1f17d6e1319fd7632d4b653d047562dc7e30f004777e224aa8213d1f9
@@ -68,20 +68,20 @@ class InvoiceData
68
68
  end
69
69
 
70
70
  def validate_detalles
71
- unless @data[:detalles]
71
+ unless @data['detalles']
72
72
  raise "invoice_data debe conteter el attributo detalles"
73
73
  end
74
74
  end
75
75
 
76
76
  def validate_cabecera
77
- unless @data[:cabecera]
77
+ unless @data['cabecera']
78
78
  raise "invoice_data debe conteter el attributo cabecera"
79
79
  end
80
80
 
81
81
  missing_fields = []
82
82
 
83
83
  InvoiceData.allowed_cabecera_fields.each do |field|
84
- if @data[:cabecera][field.to_sym].nil? && ALLOWED_CABECERA_FIELDS[field.to_sym][:mandatory]
84
+ if @data['cabecera'][field.to_s].nil? && ALLOWED_CABECERA_FIELDS[field.to_sym][:mandatory]
85
85
  missing_fields << field
86
86
  end
87
87
  end
@@ -1,5 +1,5 @@
1
1
  require 'nokogiri'
2
- require_relative 'invoice_data'
2
+ require_relative 'facturas_xml/invoice_data'
3
3
 
4
4
  class FacturasXML
5
5
  attr_accessor :invoice_data, :signature
@@ -12,7 +12,7 @@ class FacturasXML
12
12
  Nokogiri::XML::Builder.with(template) do |xml|
13
13
  xml.facturaElectronicaCompraVenta('xmlns:xsi': "http://www.w3.org/2001/XMLSchema-instance", 'xsi:noNamespaceSchemaLocation': "facturaElectronicaCompraVenta.xsd") {
14
14
  self.cabecera(xml)
15
- @invoice_data[:detalles].each do |data|
15
+ @invoice_data['detalles'].each do |data|
16
16
  self.detalle(xml, data)
17
17
  end
18
18
  self.signature(xml)
@@ -24,7 +24,7 @@ class FacturasXML
24
24
  def self.cabecera(xml)
25
25
  xml.cabecera {
26
26
  InvoiceData.allowed_cabecera_fields.each do |field_name|
27
- self.invoice_field(xml, @invoice_data[:cabecera], field_name)
27
+ self.invoice_field(xml, @invoice_data['cabecera'], field_name)
28
28
  end
29
29
  xml.codigoDocumentoSector 1
30
30
  }
@@ -39,7 +39,7 @@ class FacturasXML
39
39
  end
40
40
 
41
41
  def self.invoice_field(xml, data, field_name)
42
- value = data[field_name.to_sym]
42
+ value = data[field_name.to_s]
43
43
  attributes = value ? {} : {'xsi:nil': "true"}
44
44
  xml.send(field_name, value, attributes)
45
45
  end
@@ -55,13 +55,13 @@ class FacturasXML
55
55
  xml.Transform('Algorithm': "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments")
56
56
  }
57
57
  xml.DigestMethod('Algorithm': "http://www.w3.org/2001/04/xmlenc#sha256")
58
- xml.DigestValue(@signature[:DiggestValue])
58
+ xml.DigestValue(@signature['DiggestValue'])
59
59
  }
60
60
  }
61
- xml.SignatureValue(@signature[:SignatureValue])
61
+ xml.SignatureValue(@signature['SignatureValue'])
62
62
  xml.KeyInfo {
63
63
  xml.X509Data {
64
- xml.X509Certificate(@signature[:X509Certificate])
64
+ xml.X509Certificate(@signature['X509Certificate'])
65
65
  }
66
66
  }
67
67
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facturas_xml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Arteaga Carvalho
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-29 00:00:00.000000000 Z
11
+ date: 2023-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -115,7 +115,7 @@ executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
- - lib/facturas_xml/facturas_xml.rb
118
+ - lib/facturas_xml.rb
119
119
  - lib/facturas_xml/invoice_data.rb
120
120
  homepage: https://github.com/tiendabo/facturas_xml
121
121
  licenses: