eaternet 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.inch.yml +5 -0
- data/Guardfile +36 -0
- data/README.md +23 -23
- data/Rakefile +1 -1
- data/eaternet.gemspec +13 -11
- data/lib/eaternet.rb +8 -4
- data/lib/eaternet/agencies/nyc.rb +44 -20
- data/lib/eaternet/agencies/snhd.rb +24 -21
- data/lib/eaternet/lives_1_0.rb +240 -0
- data/lib/eaternet/loggable.rb +16 -0
- data/lib/eaternet/prototype.rb +112 -0
- data/lib/eaternet/version.rb +1 -1
- data/test/lives_1_0/business_test.rb +7 -10
- data/test/lives_1_0/feed_info_test.rb +3 -6
- data/test/lives_1_0/inspection_test.rb +10 -13
- data/test/lives_1_0/legend_test.rb +23 -26
- data/test/loggable_test.rb +15 -0
- data/test/nyc_adapter_test.rb +8 -11
- data/test/snhd_adapter_test.rb +39 -7
- data/test/test_helper.rb +3 -0
- metadata +38 -4
- data/lib/eaternet/framework/lives_1_0.rb +0 -232
- data/lib/eaternet/framework/prototype.rb +0 -109
@@ -1,109 +0,0 @@
|
|
1
|
-
module Eaternet
|
2
|
-
module Framework
|
3
|
-
# A first pass at a health scores mini-framework which
|
4
|
-
# is denormalized and provides some more information than
|
5
|
-
# LIVES.
|
6
|
-
module Prototype
|
7
|
-
|
8
|
-
module AbstractAdapter
|
9
|
-
# @return [Enumerable<BusinessData>]
|
10
|
-
def businesses
|
11
|
-
fail 'Override this to return an Enumerable of BusinessData objects'
|
12
|
-
end
|
13
|
-
|
14
|
-
# @return [Enumerable<InspectionData>]
|
15
|
-
def inspections
|
16
|
-
fail 'Override this to return an Enumerable of InspectionData objects'
|
17
|
-
end
|
18
|
-
|
19
|
-
# @return [Enumerable<ViolationData>]
|
20
|
-
def violations
|
21
|
-
fail 'Override this to return an Enumerable of ViolationData objects'
|
22
|
-
end
|
23
|
-
|
24
|
-
# @return [Enumerable<ViolationData>]
|
25
|
-
def violation_kinds
|
26
|
-
fail 'Override this to return an Enumerable of ViolationKindData objects'
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
class BusinessData
|
31
|
-
# @return [String]
|
32
|
-
attr_reader :name, :address, :city, :zipcode, :orig_key
|
33
|
-
|
34
|
-
def initialize(name:, address:, city:, zipcode:, orig_key:)
|
35
|
-
@name = name
|
36
|
-
@address = address
|
37
|
-
@city = city
|
38
|
-
@zipcode = zipcode
|
39
|
-
@orig_key = orig_key
|
40
|
-
end
|
41
|
-
|
42
|
-
def ==(other)
|
43
|
-
@orig_key == other.orig_key
|
44
|
-
end
|
45
|
-
|
46
|
-
def eql?(other)
|
47
|
-
self == other
|
48
|
-
end
|
49
|
-
|
50
|
-
def hash
|
51
|
-
@orig_key.hash
|
52
|
-
end
|
53
|
-
|
54
|
-
# @return [String]
|
55
|
-
def to_s
|
56
|
-
"Business #{@orig_key}"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
class InspectionData
|
61
|
-
# @return [String]
|
62
|
-
attr_reader :orig_key, :business_orig_key, :score, :date
|
63
|
-
|
64
|
-
def initialize(orig_key:, business_orig_key:, score:, date:)
|
65
|
-
@orig_key = orig_key
|
66
|
-
@business_orig_key = business_orig_key
|
67
|
-
@score = score
|
68
|
-
@date = date
|
69
|
-
end
|
70
|
-
|
71
|
-
def to_s
|
72
|
-
"Inspection #{@orig_key}"
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
class ViolationData
|
77
|
-
# @return [String]
|
78
|
-
attr_reader :orig_key, :inspection_id, :violation_kind_id
|
79
|
-
|
80
|
-
def initialize(orig_key:, inspection_id:, violation_kind_id:)
|
81
|
-
@orig_key = orig_key
|
82
|
-
@inspection_id = inspection_id
|
83
|
-
@violation_kind_id = violation_kind_id
|
84
|
-
end
|
85
|
-
|
86
|
-
def to_s
|
87
|
-
"Violation #{@orig_key}"
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
class ViolationKindData
|
92
|
-
# @return [String]
|
93
|
-
attr_reader :orig_key, :code, :demerits, :description
|
94
|
-
|
95
|
-
def initialize(orig_key:, code:, demerits:, description:)
|
96
|
-
@orig_key = orig_key
|
97
|
-
@code = code
|
98
|
-
@demerits = demerits
|
99
|
-
@description = description
|
100
|
-
end
|
101
|
-
|
102
|
-
def to_s
|
103
|
-
"ViolationKind #{@orig_key}"
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|