catalogos_sat 0.0.99 → 0.0.991

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 +5 -5
  2. data/lib/catalogos_sat.rb +12 -27
  3. metadata +2 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ccd257af1aa5eafec9231c1c6351403cb9d2f8ac
4
- data.tar.gz: b2ddc7c1a7eb59d1fe44ce7f920dcded54a3c25e
2
+ SHA256:
3
+ metadata.gz: f4c5e2c88bf123716be66bc49e2aa2cc669ab0f734bd8f0da7f5f424807b6ac9
4
+ data.tar.gz: 9fd4381837e7e70a61a917f5a179cd8baa8b6cb72fc8d5158a70c2329da5d514
5
5
  SHA512:
6
- metadata.gz: e2c0f8935a41bd3c6a65066bb27faa16ba30d937ebd824963d5f7d284ab69b42f3f199482401ffa97ac3a7d8f5207ff4da1de2a507c4cf0d181dba37b00b3a0f
7
- data.tar.gz: 223c6610d10de099f13dc89b9f37004949c463de29d86d00cccbd5970e6b0827808258895ca84240c60bd81e4ee4fea6a79b5cc72e045b0a26fcaba21b4a390c
6
+ metadata.gz: 46b9e829b7a969804718d2c1c74404cc1b0eb3d85d86d6174a8ebb6a480c49feeb415ac52b1a016373a4c12ba91af4e922a88f4bed567ff6047b1626d7a1a5b8
7
+ data.tar.gz: 64283298d073eb1483a9b9cb49a05acaa46083b0b3357c4fe83da29667f7b99ea4c84c7b81c876dd3d92c398f6542792cc75039f4fc023d9d117427512f28b6c
@@ -39,7 +39,8 @@ class Catalogos
39
39
  }
40
40
  @last_eTag = nil
41
41
  @local_last = nil
42
- @catalogos_url = "http://omawww.sat.gob.mx/tramitesyservicios/Paginas/documentos/catCFDI.xls"
42
+ @catalogos_html_url = "http://omawww.sat.gob.mx/tramitesyservicios/Paginas/anexo_20_version3-3.htm"
43
+ @catalogos_xls_url = "http://omawww.sat.gob.mx/tramitesyservicios/Paginas/documentos/catCFDI.xls"
43
44
 
44
45
  end
45
46
 
@@ -83,7 +84,7 @@ class Catalogos
83
84
  url_excel = URI.parse(url_excel)
84
85
  bytesDescargados = 0
85
86
 
86
- httpWork = Net::HTTP.start(url_excel.host) do
87
+ _httpWork = Net::HTTP.start(url_excel.host) do
87
88
  |http|
88
89
  response = http.request_head(url_excel.path)
89
90
  totalSize = response['content-length'].to_i
@@ -112,6 +113,14 @@ class Catalogos
112
113
  return true
113
114
 
114
115
  end
116
+
117
+ def get_url_xls()
118
+ return @catalogos_xls_url
119
+ end
120
+
121
+ def get_url_html()
122
+ return @catalogos_html_url
123
+ end
115
124
 
116
125
  # Genera un folder "catalogosJSON" en la ruta temporal del sistema operativo, requiere que ya exista el .xls generado,
117
126
  # usualmente se usa despues de mandar llamar descargar.
@@ -348,7 +357,7 @@ class Catalogos
348
357
  def nueva_last(url_excel = @catalogos_url)
349
358
  url_excel = URI.parse(url_excel)
350
359
  new_last = nil
351
- httpWork = Net::HTTP.start(url_excel.host) do
360
+ _httpWork = Net::HTTP.start(url_excel.host) do
352
361
  |http|
353
362
  response = http.request_head(url_excel.path)
354
363
  new_last = response['Last-Modified']
@@ -369,31 +378,7 @@ class Catalogos
369
378
 
370
379
  end
371
380
 
372
- =begin
373
- def nueva_eTag(url_excel = @catalogos_url)
374
- url_excel = URI.parse(url_excel)
375
- new_eTag = nil
376
- httpWork = Net::HTTP.start(url_excel.host) do
377
- |http|
378
- response = http.request_head(url_excel.path)
379
- new_eTag = response['etag']
380
- end
381
- return new_eTag
382
- end
383
381
 
384
- # Compara el eTag del .xls en la pagina del SAT con el @last_eTag
385
- # @param local_eTag [String] siempre intentara utilizar el @last_eTag a menos que se mande explicitamente un eTag, este se puede
386
- # obtener de @last_eTag en una iteracion previa del programa.
387
- # @param url_excel [String] el url donde el SAT tiene los catalogos, valor default @catalogos_url
388
- # @return [Bool] verdadero si los eTags son distintos, es decir, si hay una nueva version disponible.
389
- def nuevo_xls?(local_eTag = nil, url_excel = @catalogos_url)
390
- local_eTag = @local_eTag if local_eTag.nil?
391
- new_eTag = nueva_eTag(url_excel)
392
-
393
- return new_eTag != local_eTag
394
-
395
- end
396
- =end
397
382
 
398
383
  # Encapsula los demas metodos en una sola rutina
399
384
  # @param local_eTag [String] siempre intentara utilizar el @last_eTag a menos que se mande explicitamente un eTag, este se puede
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.99
4
+ version: 0.0.991
5
5
  platform: ruby
6
6
  authors:
7
7
  - BambuCode
@@ -66,8 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
68
  requirements: []
69
- rubyforge_project:
70
- rubygems_version: 2.5.2.3
69
+ rubygems_version: 3.0.3
71
70
  signing_key:
72
71
  specification_version: 4
73
72
  summary: Script para generar JSONS de catalogos del SAT