eaternet 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eaternet/lives_1_0.rb +26 -8
- data/lib/eaternet/loggable.rb +3 -0
- data/lib/eaternet/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0c7cf9f3ade633780c1f1a0fe0c53737bdef0a1
|
4
|
+
data.tar.gz: 65c597f98824f85517854ba003383ea92c0f571a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a48aa898e82a87084fabd8f08ed9c9e9c5d6bd80ec4d2b69c69dd194be431bf421f6551330924605ff9448c07450d35073bf50c0b19a11e29e0ee9a9ba46fc6
|
7
|
+
data.tar.gz: 28d011e3eb2de88ee6ee13698d164a45162b1fba91d69c53e4d12c216369551ce069dd4a6a1698473732bfc35c07280a3f081d65617b564bffe61f8ac3948407
|
data/lib/eaternet/lives_1_0.rb
CHANGED
@@ -4,17 +4,24 @@ module Eaternet
|
|
4
4
|
# Framework for creating LIVES 1.0 apps.
|
5
5
|
#
|
6
6
|
# The goal is to make it as easy as possible to create
|
7
|
-
# compliant implementations. And so, the Business,
|
8
|
-
#
|
9
|
-
#
|
7
|
+
# compliant implementations. And so, the {Lives_1_0::Business},
|
8
|
+
# {Lives_1_0::Inspection},
|
9
|
+
# and other data objects validate themselves for adherence
|
10
|
+
# to the spec.
|
10
11
|
#
|
11
|
-
# @see http://www.yelp.com/healthscores
|
12
|
+
# @see http://www.yelp.com/healthscores Local Inspector Value-Entry
|
13
|
+
# Specification (LIVES)
|
12
14
|
# @see http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord/
|
13
15
|
# @see http://www.rubyinside.com/rails-3-0s-activemodel-how-to-give-ruby-classes-some-activerecord-magic-2937.html
|
14
16
|
module Lives_1_0
|
15
|
-
require 'active_model'
|
16
17
|
|
18
|
+
# We use {ActiveModel::Validations} for great self-validating
|
19
|
+
# Ruby objects.
|
20
|
+
require 'active_model'
|
17
21
|
|
22
|
+
# @abstract Subclass and override {#businesses}, {#inspections},
|
23
|
+
# and optionally {#violations} and {#feed_info} to implement
|
24
|
+
# a custom Lives 1.0 data source adapter.
|
18
25
|
class Adapter
|
19
26
|
# Required.
|
20
27
|
# @return [Enumerable<Business>]
|
@@ -52,7 +59,7 @@ module Eaternet
|
|
52
59
|
|
53
60
|
|
54
61
|
private
|
55
|
-
|
62
|
+
|
56
63
|
def check_validations!
|
57
64
|
fail ArgumentError, errors.messages.inspect if invalid?
|
58
65
|
end
|
@@ -67,7 +74,19 @@ module Eaternet
|
|
67
74
|
|
68
75
|
|
69
76
|
# A food service establishment, e.g. a restaurant.
|
70
|
-
#
|
77
|
+
#
|
78
|
+
# @!attribute [rw] business_id
|
79
|
+
# @return [String] Unique identifier for the business. For many cities,
|
80
|
+
# this may be the license number.
|
81
|
+
#
|
82
|
+
# @!attribute [rw] name
|
83
|
+
# @return [String] Common name of the business
|
84
|
+
#
|
85
|
+
# @!attribute [rw] address
|
86
|
+
# @return [String] Street address of the business. For example: 706
|
87
|
+
# Mission St.
|
88
|
+
#
|
89
|
+
# @see http://www.yelp.com/healthscores#businesses LIVES/Business
|
71
90
|
class Business < ValidatedObject
|
72
91
|
attr_accessor :business_id, :name, :address, :city, :state,
|
73
92
|
:postal_code, :latitude, :longitude, :phone_number
|
@@ -105,7 +124,6 @@ module Eaternet
|
|
105
124
|
@business_id.hash
|
106
125
|
end
|
107
126
|
|
108
|
-
# :nodoc:
|
109
127
|
# @return [String]
|
110
128
|
def to_s
|
111
129
|
"Business #{@business_id}"
|
data/lib/eaternet/loggable.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
module Eaternet
|
2
2
|
module Loggable
|
3
3
|
|
4
|
+
# @return [Logger] the configured logger singleton
|
4
5
|
def logger
|
5
6
|
@logger ||= create_logger
|
6
7
|
end
|
7
8
|
|
9
|
+
private
|
10
|
+
|
8
11
|
def create_logger
|
9
12
|
logger = Logger.new(ENV['EATERNET_LOG_FILE'] || $stderr)
|
10
13
|
logger.datetime_format = '%Y-%m-%d %H:%M:%S'
|
data/lib/eaternet/version.rb
CHANGED
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: 0.3.
|
4
|
+
version: 0.3.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: 2015-05-
|
11
|
+
date: 2015-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
221
|
version: '0'
|
222
222
|
requirements: []
|
223
223
|
rubyforge_project:
|
224
|
-
rubygems_version: 2.4.
|
224
|
+
rubygems_version: 2.4.3
|
225
225
|
signing_key:
|
226
226
|
specification_version: 4
|
227
227
|
summary: Regional adapters for restaurant health scores
|
@@ -236,4 +236,3 @@ test_files:
|
|
236
236
|
- test/nyc_adapter_test.rb
|
237
237
|
- test/snhd_adapter_test.rb
|
238
238
|
- test/test_helper.rb
|
239
|
-
has_rdoc:
|