catalogos_sat 0.0.7 → 0.0.8
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 +4 -4
- data/lib/catalogos_sat.rb +11 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15d9ad5e4dae98afa16f21aa5f9ee2d004715e52
|
4
|
+
data.tar.gz: 53f0a0306f95a2821b825493817942a55f026ae2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1b5d267c11a30f342fd9a465945f2c0fffdee97c935c2d3480bb2e6fe931d62b23252d2b2e8c717c315874a96acbe555f4400bf417a65a73fd71608c1b0bcdf
|
7
|
+
data.tar.gz: 8ade3bbe46a9a2ebc478983bcd6c9a55701f4328f0c0a011daf3d4e642626452218a98a028600634220cbcda4065db8923a4e84173987e1f7b429e27a4e70fd7
|
data/lib/catalogos_sat.rb
CHANGED
@@ -269,22 +269,25 @@ class Catalogos
|
|
269
269
|
|
270
270
|
end
|
271
271
|
|
272
|
-
|
273
|
-
# @param local_eTag [String] siempre intentara utilizar el @last_eTag a menos que se mande explicitamente un eTag, este se puede
|
274
|
-
# obtener de @last_eTag en una iteracion previa del programa.
|
275
|
-
# @param url_excel [String] el url donde el SAT tiene los catalogos, valor default "http://www.sat.gob.mx/informacion_fiscal/factura_electronica/Documents/catCFDI.xls"
|
276
|
-
# @return [Bool] verdadero si los eTags son distintos, es decir, si hay una nueva version disponible.
|
277
|
-
def nuevo_xls?(local_eTag = nil, url_excel = "http://www.sat.gob.mx/informacion_fiscal/factura_electronica/Documents/catCFDI.xls")
|
278
|
-
local_eTag = @local_eTag if local_eTag.nil?
|
272
|
+
def nueva_eTag(url_excel = "http://www.sat.gob.mx/informacion_fiscal/factura_electronica/Documents/catCFDI.xls")
|
279
273
|
url_excel = URI.parse(url_excel)
|
280
274
|
new_eTag = nil
|
281
|
-
|
282
275
|
httpWork = Net::HTTP.start(url_excel.host) do
|
283
276
|
|http|
|
284
277
|
response = http.request_head(url_excel.path)
|
285
278
|
new_eTag = response['etag'].split(",")[0]
|
286
279
|
end
|
280
|
+
return new_eTag
|
281
|
+
end
|
287
282
|
|
283
|
+
# Compara el eTag del .xls en la pagina del SAT con el @last_eTag
|
284
|
+
# @param local_eTag [String] siempre intentara utilizar el @last_eTag a menos que se mande explicitamente un eTag, este se puede
|
285
|
+
# obtener de @last_eTag en una iteracion previa del programa.
|
286
|
+
# @param url_excel [String] el url donde el SAT tiene los catalogos, valor default "http://www.sat.gob.mx/informacion_fiscal/factura_electronica/Documents/catCFDI.xls"
|
287
|
+
# @return [Bool] verdadero si los eTags son distintos, es decir, si hay una nueva version disponible.
|
288
|
+
def nuevo_xls?(local_eTag = nil, url_excel = "http://www.sat.gob.mx/informacion_fiscal/factura_electronica/Documents/catCFDI.xls")
|
289
|
+
local_eTag = @local_eTag if local_eTag.nil?
|
290
|
+
new_eTag = nueva_eTag(url_excel)
|
288
291
|
|
289
292
|
return new_eTag != local_eTag
|
290
293
|
|