eaternet 0.3.13 → 0.3.14

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
  SHA1:
3
- metadata.gz: 5fef9d7a3fae0dfa7a51a9dbf736c5da15bfa268
4
- data.tar.gz: f62290193115c8e762a8d7dbbbd2fe1f5de869a0
3
+ metadata.gz: 909fb5a4626a18c37b4d3694bd0fdf1a8f8b69a7
4
+ data.tar.gz: b6a05cf7dc6d76a5f10b4dc2e949c03d277da7da
5
5
  SHA512:
6
- metadata.gz: b5f431d8091b289152792306ccf263aa2e25189e2f464a7af4ee676488f4b084f28f2e1285e5e995638d7c07e8e860e81eb93e3caf5f1a086bcfcb67b81986e3
7
- data.tar.gz: 1004ff11639225f50e13965f6e359f6c79db8f0861afaf7486dc3eff06e4c014ead6ae389154dcca9eec1bd4f3fd6ee97ad6788e6ec5370947b940cf18433dc1
6
+ metadata.gz: e45b4ee75bf988fb28461b3cc19267ada7963e43967b80bb87537055b6f96a119829eafab6029bff68ede7830f433f129065a43a8a26827f51a09a4c9b81204c
7
+ data.tar.gz: 2cb9c2a9f6e221c52c8a8905e501aefd3b7f0a28cc4ff2e3d0a477726644eba9779c383aefefe94b988686265125b4ce70585b7f15136858835dbc9e397c4bec
@@ -16,13 +16,14 @@ module Eaternet
16
16
  # retrieves the latest CSV export from
17
17
  # [the official source](https://data.cityofnewyork.us/Health/DOHMH-New-York-City-Restaurant-Inspection-Results/xx67-kt59)
18
18
  # and makes it easy to work with. The downloaded CSV is cached for twelve
19
- # hours in a temporary file by {Eaternet::Util.download_and_cache}
19
+ # hours in a temporary file.
20
20
  #
21
21
  # This library conforms to the
22
22
  # [LIVES 1.0 standard](http://www.yelp.com/healthscores) developed by
23
23
  # Yelp and the cities of San Francisco and New York.
24
24
  #
25
25
  # @example Print the names of all the restaurants in New York City
26
+ # require 'eaternet'
26
27
  # nyc = Eaternet::Nyc.new
27
28
  # puts nyc.businesses.map(&:name)
28
29
  #
@@ -7,6 +7,8 @@ module Eaternet
7
7
  module Agencies
8
8
  # An adapter for the Southern Nevada Health District (Las Vegas).
9
9
  #
10
+ # @note This is a work in progress.
11
+ #
10
12
  # @example Print the names of all the Las Vegas businesses
11
13
  # require 'eaternet'
12
14
  #
@@ -1,5 +1,6 @@
1
1
  module Eaternet
2
2
  module Agencies
3
+ # @private
3
4
  class SnhdConfig
4
5
  DOWNLOAD_URL = 'http://southernnevadahealthdistrict.org/restaurants/download/restaurants.zip'
5
6
  COLUMN_SEPARATOR = ';'
@@ -1,8 +1,9 @@
1
1
  module Eaternet
2
2
  # A first pass at a health scores mini-framework which
3
- # is denormalized and provides some more information than
3
+ # is normalized and provides some more information than
4
4
  # LIVES.
5
- #:nodoc:
5
+ #
6
+ # @private
6
7
  module Prototype
7
8
  module AbstractAdapter
8
9
  # @return [Enumerable<BusinessData>]
data/lib/eaternet/util.rb CHANGED
@@ -17,13 +17,15 @@ module Eaternet
17
17
 
18
18
  # Create a temporary directory which is automatically
19
19
  # deleted when the program exits.
20
+ #
21
+ # @return [String] the directory path
20
22
  def self.make_temp_dir
21
23
  dir = Dir.mktmpdir
22
24
  at_exit { FileUtils.remove_entry dir }
23
25
  dir
24
26
  end
25
27
 
26
- # Download a file from the network, caching it for 12 hours.
28
+ # Download a file from the network, using a 12-hour cache.
27
29
  #
28
30
  # @param [String] source the URL to retrieve
29
31
  # @param [String] dest pathname in which to save the file
@@ -60,24 +62,28 @@ module Eaternet
60
62
 
61
63
  # Remove extraneous whitespace and ensure capitalization
62
64
  # is correct for a proper name or title.
65
+ #
66
+ # @return [String] the cleaned up string
63
67
  def self.cleanup_title(a_string)
64
68
  return nil if a_string.nil?
65
69
  cleanup(a_string).titleize
66
70
  end
67
71
 
68
72
  # Remove extraneous whitespace from the string
73
+ #
74
+ # @return [String] the cleaned up string
69
75
  def self.cleanup(a_string)
70
76
  return nil if a_string.nil?
71
77
  a_string.strip.gsub(/ +/, ' ')
72
78
  end
73
79
 
80
+ # @return [Float]
74
81
  def self.file_age_in_days(path)
75
82
  (Time.now - File.mtime(path)).to_i / 86_400.0
76
83
  end
77
84
 
78
- #
79
- # private
80
- #
85
+
86
+ private
81
87
 
82
88
  def self.expired?(cache_path)
83
89
  !File.exist?(cache_path) || file_age_in_days(cache_path) > 0.5
@@ -1,3 +1,3 @@
1
1
  module Eaternet
2
- VERSION = '0.3.13'
2
+ VERSION = '0.3.14'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eaternet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robb Shecter