eaternet 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6eb3f1b95324d324a96a86b17b3443c2a63faf7f
4
- data.tar.gz: d632f2ab776c0b300585aeed643a62ad409e3fda
3
+ metadata.gz: ed980faad2a78ad6296326f407ecef535d48232b
4
+ data.tar.gz: 1a60560689dccb31966b409a293d319074ab641a
5
5
  SHA512:
6
- metadata.gz: 540884ffeac6ea7565996b267098cf5ceaf9ad1c4598ed37032ed97183a6e813376bb19bd6c279db3d78b4567f4c170530fc86a76f2a85fa15a506aea2548e87
7
- data.tar.gz: 2ed55163141bcabeffc106ac400a4873257a50e193fb692809068bf5957de7cd1e45595a250a12e8c0f7840b6f7a6f4601be34c0e309375a2c6d6b20ef9896bf
6
+ metadata.gz: ef0b520bc6259dfdcd473998c14d92a8f896ce6eccb8b75ccaed9b35a851829e7af500e937713c3772f405d99d5e426ad043adc4676d74aa0bb10ca1966e6bd6
7
+ data.tar.gz: d7ac9a6237cf1ac5f94856359b1c13b8dc35d8dfc7ce0bd0e922a85d1bc9f7b2176175458544604c850f38c4330cf6811d98a27151d8a0a312d73c687f2ad6e0
@@ -16,6 +16,11 @@ module Eaternet
16
16
  .map { |proto| try_to_create_business(proto) }
17
17
  end
18
18
 
19
+ def inspections
20
+ @prototype.inspections
21
+ .map { |proto| try_to_create_inspection(proto) }
22
+ end
23
+
19
24
  def try_to_create_business(proto)
20
25
  business(proto)
21
26
  rescue ArgumentError => e
@@ -25,6 +30,15 @@ module Eaternet
25
30
  nil
26
31
  end
27
32
 
33
+ def try_to_create_inspection(proto)
34
+ inspection(proto)
35
+ rescue ArgumentError => e
36
+ logger.warn('SNHD LIVES adapter') do
37
+ "Could not create a LIVES Inspection from #{proto.inspect}: #{e}"
38
+ end
39
+ nil
40
+ end
41
+
28
42
  def business(proto)
29
43
  Business.new do |b|
30
44
  b.business_id = proto.orig_key
@@ -36,15 +50,12 @@ module Eaternet
36
50
  end
37
51
  end
38
52
 
39
- def inspections
40
- @prototype.inspections
41
- .map { |proto|
42
- Inspection.new do |i|
43
- i.business_id = proto.business_orig_key
44
- i.score = proto.demerits.nil? ? nil : 100 - proto.demerits.to_i
45
- i.date = Date.parse(proto.date)
46
- end
47
- }
53
+ def inspection(proto)
54
+ Inspection.new do |i|
55
+ i.business_id = proto.business_orig_key
56
+ i.score = proto.demerits.nil? ? nil : 100 - proto.demerits.to_i
57
+ i.date = Date.parse(proto.date)
58
+ end
48
59
  end
49
60
 
50
61
  def violations
@@ -1,3 +1,3 @@
1
1
  module Eaternet
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
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.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robb Shecter