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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/catalogos_sat.rb +11 -8
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa7e3051e8f148e939e0a3b330394b56e3cd587b
4
- data.tar.gz: e1f23862c8ca1367b8cd4d975a06d4a93d00db17
3
+ metadata.gz: 15d9ad5e4dae98afa16f21aa5f9ee2d004715e52
4
+ data.tar.gz: 53f0a0306f95a2821b825493817942a55f026ae2
5
5
  SHA512:
6
- metadata.gz: 4954a2532840a5e60948e0a5c3bf4d9ca0411e7e7316f4f8a1ca238b7ec74fb08c7492ca27f2aa66d1bbfcab48ee6c3476d71cdc57284cc79626d4ca77d8af4f
7
- data.tar.gz: 6dce206f66e23c63a269080e2f052ccf1c9d09f9fa51e74fe8b7f8ab83b063a58bb1f78d6c46a4a308c30596f4e413a4189059b3f22d8925f023795d79c7ce62
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
- # Compara el eTag del .xls en la pagina del SAT con el @last_eTag
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catalogos_sat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - BambuCode