eaternet 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/lib/eaternet/agencies/nyc.rb +2 -1
- data/lib/eaternet/loggable.rb +1 -1
- data/lib/eaternet/util.rb +2 -12
- data/lib/eaternet/version.rb +1 -1
- data/test/eaternet/util_test.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bea0f02da14266e9021bb9ba118ac852cbca8d4f
|
4
|
+
data.tar.gz: d931c40c286985d654270bd2ef36a0f7d946c575
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a33a879a009eb468307e9f6975cbf020c48655a5d89353f0b5a114f1b21b114cdb48cacc4f0cfc3b12c1ecef0f8f1c41ae1ad87ba365d81dd53bb8677163a243
|
7
|
+
data.tar.gz: de074c2a1eb77824cecfa79b4b42867994180cf609c64e79a73286bc4f65ef39ee7aa11fe932884b27e3c37767d3d6125412e97a04acaa79abade6732988ce2b
|
data/.travis.yml
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'csv'
|
2
3
|
require 'json'
|
3
4
|
require 'logger'
|
@@ -193,7 +194,7 @@ module Eaternet
|
|
193
194
|
end
|
194
195
|
|
195
196
|
def table_file
|
196
|
-
|
197
|
+
Nyc.download_via_url
|
197
198
|
end
|
198
199
|
|
199
200
|
# Fastest method for downloading all data but may be non-standard
|
data/lib/eaternet/loggable.rb
CHANGED
data/lib/eaternet/util.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'base64'
|
2
3
|
require 'zip'
|
3
4
|
require 'httparty'
|
@@ -9,30 +10,19 @@ module Eaternet
|
|
9
10
|
#
|
10
11
|
# @return [String] the directory path
|
11
12
|
def self.download_and_extract_zipfile(url)
|
12
|
-
dir =
|
13
|
+
dir = Dir.mktmpdir
|
13
14
|
zip_path = File.join(dir, 'zip-file.zip')
|
14
15
|
download_and_cache(source: url, dest: zip_path)
|
15
16
|
extract_zipfile(path: zip_path, dest_dir: dir)
|
16
17
|
dir
|
17
18
|
end
|
18
19
|
|
19
|
-
# Create a temporary directory which is automatically deleted when the
|
20
|
-
# program exits.
|
21
|
-
#
|
22
|
-
# @return [String] the directory path
|
23
|
-
def self.make_temp_dir
|
24
|
-
dir = Dir.mktmpdir
|
25
|
-
at_exit { FileUtils.remove_entry dir }
|
26
|
-
dir
|
27
|
-
end
|
28
|
-
|
29
20
|
# Download a file from the network, using a 12-hour cache.
|
30
21
|
#
|
31
22
|
# @param [String] source the URL to retrieve
|
32
23
|
# @param [String] dest pathname in which to save the file
|
33
24
|
# @return [File] the file
|
34
25
|
def self.download_and_cache(source:, dest:)
|
35
|
-
# download(source: source, dest: dest)
|
36
26
|
cache_path = generate_cache_path(source)
|
37
27
|
download(source: source, dest: cache_path) if expired? cache_path
|
38
28
|
FileUtils.cp cache_path, dest
|
data/lib/eaternet/version.rb
CHANGED
data/test/eaternet/util_test.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'tempfile'
|
2
3
|
require 'test_helper'
|
3
4
|
require 'timecop'
|
@@ -33,7 +34,7 @@ class UtilTest < Minitest::Test
|
|
33
34
|
end
|
34
35
|
|
35
36
|
def test_uses_a_file_cache
|
36
|
-
|
37
|
+
3.times { download_and_cache }
|
37
38
|
assert_requested :get, @url, times: 1
|
38
39
|
end
|
39
40
|
|
@@ -43,5 +44,4 @@ class UtilTest < Minitest::Test
|
|
43
44
|
Timecop.freeze(Time.now + thirteen_hours) { download_and_cache }
|
44
45
|
assert_requested :get, @url, times: 2
|
45
46
|
end
|
46
|
-
|
47
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eaternet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robb Shecter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -317,7 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
317
317
|
version: '0'
|
318
318
|
requirements: []
|
319
319
|
rubyforge_project:
|
320
|
-
rubygems_version: 2.
|
320
|
+
rubygems_version: 2.6.6
|
321
321
|
signing_key:
|
322
322
|
specification_version: 4
|
323
323
|
summary: Regional adapters for restaurant health scores
|