eaternet 0.3.2 → 0.3.3
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 +4 -4
 - data/lib/eaternet/lives_1_0.rb +51 -9
 - data/lib/eaternet/version.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: af8af2d45bbf5b308fb47e75f501a35bf436447f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0db0339d37d25f2436b7beeb5b13b07ffc35ee83
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 88ca6e813d927bcd80cc14b311e6082c378efff9ce359ae28e2af25e0cc57264249704d99c7f31a4ab239967ae6f12fba293acaeb581f4be29ad52bf45d38603
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 3a95dca9298441e8c3779ac08e27c8b8ecbffc9c9770c939494285ce9a9bd1559f3cce2fc67e4c0627222b4f28f3544087db0c2c2a8b1c441b36591942d03772
         
     | 
    
        data/lib/eaternet/lives_1_0.rb
    CHANGED
    
    | 
         @@ -11,12 +11,7 @@ module Eaternet 
     | 
|
| 
       11 
11 
     | 
    
         
             
              #
         
     | 
| 
       12 
12 
     | 
    
         
             
              # @see http://www.yelp.com/healthscores Local Inspector Value-Entry
         
     | 
| 
       13 
13 
     | 
    
         
             
              #   Specification (LIVES)
         
     | 
| 
       14 
     | 
    
         
            -
              # @see http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord/
         
     | 
| 
       15 
     | 
    
         
            -
              # @see http://www.rubyinside.com/rails-3-0s-activemodel-how-to-give-ruby-classes-some-activerecord-magic-2937.html
         
     | 
| 
       16 
14 
     | 
    
         
             
              module Lives_1_0
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
                # We use {ActiveModel::Validations} for great self-validating
         
     | 
| 
       19 
     | 
    
         
            -
                # Ruby objects.
         
     | 
| 
       20 
15 
     | 
    
         
             
                require 'active_model'
         
     | 
| 
       21 
16 
     | 
    
         | 
| 
       22 
17 
     | 
    
         
             
                # @abstract Subclass and override {#businesses}, {#inspections},
         
     | 
| 
         @@ -49,9 +44,23 @@ module Eaternet 
     | 
|
| 
       49 
44 
     | 
    
         
             
                end
         
     | 
| 
       50 
45 
     | 
    
         | 
| 
       51 
46 
     | 
    
         | 
| 
      
 47 
     | 
    
         
            +
                # Uses {ActiveModel::Validations} to create self-validating
         
     | 
| 
      
 48 
     | 
    
         
            +
                # Plain Old Ruby objects.
         
     | 
| 
      
 49 
     | 
    
         
            +
                #
         
     | 
| 
      
 50 
     | 
    
         
            +
                # @abstract Subclass and add `attr_accessor` and validations
         
     | 
| 
      
 51 
     | 
    
         
            +
                #   to create custom validating objects.
         
     | 
| 
      
 52 
     | 
    
         
            +
                #
         
     | 
| 
      
 53 
     | 
    
         
            +
                # @see http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord/
         
     | 
| 
      
 54 
     | 
    
         
            +
                # @see http://www.rubyinside.com/rails-3-0s-activemodel-how-to-give-ruby-classes-some-activerecord-magic-2937.html
         
     | 
| 
       52 
55 
     | 
    
         
             
                class ValidatedObject
         
     | 
| 
       53 
56 
     | 
    
         
             
                  include ActiveModel::Validations
         
     | 
| 
       54 
57 
     | 
    
         | 
| 
      
 58 
     | 
    
         
            +
                  # @raise [ArgumentError] if the object is not valid at the
         
     | 
| 
      
 59 
     | 
    
         
            +
                  #   end of initialization.
         
     | 
| 
      
 60 
     | 
    
         
            +
                  #
         
     | 
| 
      
 61 
     | 
    
         
            +
                  # @yieldparam [ValidatedObject] new_object the yielded new object
         
     | 
| 
      
 62 
     | 
    
         
            +
                  #   for configuration.
         
     | 
| 
      
 63 
     | 
    
         
            +
                  #
         
     | 
| 
       55 
64 
     | 
    
         
             
                  def initialize(&block)
         
     | 
| 
       56 
65 
     | 
    
         
             
                    block.call(self)
         
     | 
| 
       57 
66 
     | 
    
         
             
                    check_validations!
         
     | 
| 
         @@ -163,7 +172,39 @@ module Eaternet 
     | 
|
| 
       163 
172 
     | 
    
         
             
                end
         
     | 
| 
       164 
173 
     | 
    
         | 
| 
       165 
174 
     | 
    
         | 
| 
       166 
     | 
    
         
            -
                #  
     | 
| 
      
 175 
     | 
    
         
            +
                # Information about an inspectors’ visit to a businesses.
         
     | 
| 
      
 176 
     | 
    
         
            +
                #
         
     | 
| 
      
 177 
     | 
    
         
            +
                # @!attribute [rw] business_id
         
     | 
| 
      
 178 
     | 
    
         
            +
                #   Unique identifier of the business for which this inspection
         
     | 
| 
      
 179 
     | 
    
         
            +
                #   was done. Required.
         
     | 
| 
      
 180 
     | 
    
         
            +
                #   @return [String]
         
     | 
| 
      
 181 
     | 
    
         
            +
                #
         
     | 
| 
      
 182 
     | 
    
         
            +
                # @!attribute [rw] score
         
     | 
| 
      
 183 
     | 
    
         
            +
                #   Inspection score on a 0-100 scale. 100 is the highest score.
         
     | 
| 
      
 184 
     | 
    
         
            +
                #   This column must always be present in inspections.csv. However, it
         
     | 
| 
      
 185 
     | 
    
         
            +
                #   can be safely left blank for inspection rows that don’t have an
         
     | 
| 
      
 186 
     | 
    
         
            +
                #   associated score. (For example, some municipalities don’t associate
         
     | 
| 
      
 187 
     | 
    
         
            +
                #   a follow-up inspection with a score.)
         
     | 
| 
      
 188 
     | 
    
         
            +
                #   @return [Integer] if it's a scored inspection
         
     | 
| 
      
 189 
     | 
    
         
            +
                #   @return [String] if it's an un-scored inspection, then the return value
         
     | 
| 
      
 190 
     | 
    
         
            +
                #     will be an empty string.
         
     | 
| 
      
 191 
     | 
    
         
            +
                #
         
     | 
| 
      
 192 
     | 
    
         
            +
                # @!attribute [rw] date
         
     | 
| 
      
 193 
     | 
    
         
            +
                #   Date of the inspection.
         
     | 
| 
      
 194 
     | 
    
         
            +
                #   @return [Date]
         
     | 
| 
      
 195 
     | 
    
         
            +
                #
         
     | 
| 
      
 196 
     | 
    
         
            +
                # @!attribute [rw] description
         
     | 
| 
      
 197 
     | 
    
         
            +
                #   Single line description containing details on the outcome of an
         
     | 
| 
      
 198 
     | 
    
         
            +
                #   inspection. Use of this field is only encouraged if no violations
         
     | 
| 
      
 199 
     | 
    
         
            +
                #   are provided.
         
     | 
| 
      
 200 
     | 
    
         
            +
                #   @return [String]
         
     | 
| 
      
 201 
     | 
    
         
            +
                #
         
     | 
| 
      
 202 
     | 
    
         
            +
                # @!attribute [rw] type
         
     | 
| 
      
 203 
     | 
    
         
            +
                #   String representing the type of inspection. Must be (initial,
         
     | 
| 
      
 204 
     | 
    
         
            +
                #   routine, followup, complaint).
         
     | 
| 
      
 205 
     | 
    
         
            +
                #   @return [String]
         
     | 
| 
      
 206 
     | 
    
         
            +
                #
         
     | 
| 
      
 207 
     | 
    
         
            +
                # @see http://www.yelp.com/healthscores#inspections LIVES / Inspections
         
     | 
| 
       167 
208 
     | 
    
         
             
                class Inspection < ValidatedObject
         
     | 
| 
       168 
209 
     | 
    
         
             
                  attr_accessor :business_id, :score, :date, :description, :type
         
     | 
| 
       169 
210 
     | 
    
         | 
| 
         @@ -187,13 +228,14 @@ module Eaternet 
     | 
|
| 
       187 
228 
     | 
    
         
             
                    @score.nil? ? '' : @score
         
     | 
| 
       188 
229 
     | 
    
         
             
                  end
         
     | 
| 
       189 
230 
     | 
    
         | 
| 
      
 231 
     | 
    
         
            +
                  # @return [String]
         
     | 
| 
       190 
232 
     | 
    
         
             
                  def to_s
         
     | 
| 
       191 
233 
     | 
    
         
             
                    "Inspection #{self.business_id}/#{self.date}/#{self.score}"
         
     | 
| 
       192 
234 
     | 
    
         
             
                  end
         
     | 
| 
       193 
235 
     | 
    
         
             
                end
         
     | 
| 
       194 
236 
     | 
    
         | 
| 
       195 
237 
     | 
    
         | 
| 
       196 
     | 
    
         
            -
                # @see http://www.yelp.com/healthscores#violations
         
     | 
| 
      
 238 
     | 
    
         
            +
                # @see http://www.yelp.com/healthscores#violations LIVES / Violations
         
     | 
| 
       197 
239 
     | 
    
         
             
                class Violation < ValidatedObject
         
     | 
| 
       198 
240 
     | 
    
         
             
                  attr_accessor :business_id, :date, :code, :description
         
     | 
| 
       199 
241 
     | 
    
         | 
| 
         @@ -209,7 +251,7 @@ module Eaternet 
     | 
|
| 
       209 
251 
     | 
    
         
             
                end
         
     | 
| 
       210 
252 
     | 
    
         | 
| 
       211 
253 
     | 
    
         | 
| 
       212 
     | 
    
         
            -
                # @see http://www.yelp.com/healthscores#feed_info
         
     | 
| 
      
 254 
     | 
    
         
            +
                # @see http://www.yelp.com/healthscores#feed_info LIVES / Feed Information
         
     | 
| 
       213 
255 
     | 
    
         
             
                class FeedInfo < ValidatedObject
         
     | 
| 
       214 
256 
     | 
    
         
             
                  attr_accessor :feed_date, :feed_version, :municipality_name,
         
     | 
| 
       215 
257 
     | 
    
         
             
                                :municipality_url, :contact_email
         
     | 
| 
         @@ -238,7 +280,7 @@ module Eaternet 
     | 
|
| 
       238 
280 
     | 
    
         
             
                end
         
     | 
| 
       239 
281 
     | 
    
         | 
| 
       240 
282 
     | 
    
         | 
| 
       241 
     | 
    
         
            -
                # @see http://www.yelp.com/healthscores#legend
         
     | 
| 
      
 283 
     | 
    
         
            +
                # @see http://www.yelp.com/healthscores#legend LIVES / Legend
         
     | 
| 
       242 
284 
     | 
    
         
             
                class Legend < ValidatedObject
         
     | 
| 
       243 
285 
     | 
    
         
             
                  attr_accessor :minimum_score, :maximum_score, :description
         
     | 
| 
       244 
286 
     | 
    
         | 
    
        data/lib/eaternet/version.rb
    CHANGED