eaternet 1.3.8 → 1.3.9

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: f260d5eccf43b6198afa53dbfb57b95a64606e15
4
- data.tar.gz: 7ef2ce141bcda76e95d4f93ade84ae7fb68493f1
3
+ metadata.gz: e5d1cb4d7f2f6d148c9ca9d77df3a54f27649fab
4
+ data.tar.gz: 0924a78eebff1ac3c671606b04039f2745f00210
5
5
  SHA512:
6
- metadata.gz: 29ea9910630f0225e4f835631396d95c47677485fcaecdc62f034a0a749132cab2c2871243f451fac8aca58a9f88588f24edd6527fe283467faafe7537a3ce47
7
- data.tar.gz: 1a963f7b6143f797644bb1345d85f46a19738a5f9cdebca77797997d1d18445ee80646961d0a24f37feef93f2670646950f732b71e7e1d576261fb3d0ad1a6d1
6
+ metadata.gz: 8335d54ab71a2b26f51ce163ecbafab2cf5d9bfe36d9f337cb5fdb6d1c9ab914c02d016b083f898cb8970e6c64d90c0ce42d1d7802522af369dbdbc0ea028157
7
+ data.tar.gz: 74118d3daa2331ba2c5e9da671368e8f24c2718d32c7fcb2a43665fe889ce287aba8830e0d75e608750789a940bcfa21f8c80814ecd3cf4517fcb0fbbd00ed91
@@ -49,13 +49,19 @@ module Eaternet
49
49
 
50
50
  # (see Eaternet::Prototype::AbstractAdapter#violations)
51
51
  def violations
52
- lazy_csv_map('restaurant_inspection_violations.csv') do |row|
53
- Eaternet::Prototype::ViolationData.new(
54
- orig_key: row['inspection_violation_id'],
55
- inspection_id: row['inspection_id'],
56
- violation_kind_id: row['inspection_violation']
57
- )
52
+ result = []
53
+
54
+ inspections.each do |i|
55
+ i.violations.each do |v|
56
+ result << Eaternet::Prototype::ViolationData.new(
57
+ inspection_id: i.orig_key,
58
+ violation_kind_id: v,
59
+ orig_key: 'n/a'
60
+ )
61
+ end
58
62
  end
63
+
64
+ result
59
65
  end
60
66
 
61
67
  # @return [Enumerable<ViolationKindData>]
@@ -32,11 +32,11 @@ module Eaternet
32
32
  # @param [String] dest pathname in which to save the file
33
33
  # @return [File] the file
34
34
  def self.download_and_cache(source:, dest:)
35
- download(source: source, dest: dest)
36
- # cache_path = generate_cache_path(source)
37
- # download(source: source, dest: cache_path) if expired? cache_path
38
- # FileUtils.cp cache_path, dest
39
- # File.open dest
35
+ # download(source: source, dest: dest)
36
+ cache_path = generate_cache_path(source)
37
+ download(source: source, dest: cache_path) if expired? cache_path
38
+ FileUtils.cp cache_path, dest
39
+ File.open dest
40
40
  end
41
41
 
42
42
  # Download a file from the network.
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Eaternet
3
- VERSION = '1.3.8'
3
+ VERSION = '1.3.9'
4
4
  end
@@ -88,9 +88,9 @@ class SnhdPrototypeAdapterTest < Minitest::Test
88
88
  def test_violations_returns_correct_data
89
89
  VCR.use_cassette(SNHD_CASSETTE) do
90
90
  v = @@snhd_prototype.violations.first
91
- assert_equal '1488', v.orig_key
92
- assert_equal '537', v.inspection_id
93
- assert_equal '64', v.violation_kind_id
91
+ assert_equal 'n/a', v.orig_key
92
+ assert_equal 'DA0001096', v.inspection_id
93
+ assert_equal '8', v.violation_kind_id
94
94
  end
95
95
  end
96
96
 
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: 1.3.8
4
+ version: 1.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robb Shecter