zipcoder 0.8.1 → 0.8.2
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/README.md +2 -0
- data/lib/zipcoder/version.rb +1 -1
- data/lib/zipcoder.rb +7 -7
- data/spec/zipcoder_spec.rb +5 -0
- 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: fde88ab0a0441409d798cf1cb4ec90fb7942a218
         | 
| 4 | 
            +
              data.tar.gz: 839d0d315be9dbff593cdf0c8938e1e2ec8a9e58
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: ee21dfd66e245dc4b5a995d33f641a66ad21c9724cca7c2a3c900aa58535c040e573fa8e0b18875440f383aba91197c553d2687af10883171ee127adc0499a63
         | 
| 7 | 
            +
              data.tar.gz: 952e42c0a34cf2ef62e8b142d9bb54444792045e6bbed3046df869c8f76dfa45ef2012b8be86a004bbac1a5afdaa6e5a4c6c3a7776dc75818d26d558a04f85d6
         | 
    
        data/README.md
    CHANGED
    
    
    
        data/lib/zipcoder/version.rb
    CHANGED
    
    
    
        data/lib/zipcoder.rb
    CHANGED
    
    | @@ -113,19 +113,19 @@ module Zipcoder | |
| 113 113 | 
             
                cache_key = self._cache_key(city_state)
         | 
| 114 114 | 
             
                cached_value = self.cacher.read_city_cache(cache_key)
         | 
| 115 115 |  | 
| 116 | 
            -
                # If filter specified, create "specified_zip"
         | 
| 117 | 
            -
                if kwargs[:filter]
         | 
| 118 | 
            -
                  normal_zips = cached_value[:zip].breakout_zips
         | 
| 119 | 
            -
                  filter_zips = kwargs[:filter].breakout_zips
         | 
| 120 | 
            -
                  cached_value[:specified_zip] = (normal_zips & filter_zips).combine_zips
         | 
| 121 | 
            -
                end
         | 
| 122 | 
            -
             | 
| 123 116 | 
             
                # Return it
         | 
| 124 117 | 
             
                if cached_value == nil
         | 
| 125 118 | 
             
                  nil
         | 
| 126 119 | 
             
                elsif kwargs[:zips_only]
         | 
| 127 120 | 
             
                  cached_value[:zip].breakout_zips
         | 
| 128 121 | 
             
                else
         | 
| 122 | 
            +
                  # If filter specified, create "specified_zip"
         | 
| 123 | 
            +
                  if kwargs[:filter]
         | 
| 124 | 
            +
                    normal_zips = cached_value[:zip].breakout_zips
         | 
| 125 | 
            +
                    filter_zips = kwargs[:filter].breakout_zips
         | 
| 126 | 
            +
                    cached_value[:specified_zip] = (normal_zips & filter_zips).combine_zips
         | 
| 127 | 
            +
                  end
         | 
| 128 | 
            +
             | 
| 129 129 | 
             
                  self._filter_hash_args cached_value, kwargs[:keys]
         | 
| 130 130 | 
             
                end
         | 
| 131 131 | 
             
              end
         | 
    
        data/spec/zipcoder_spec.rb
    CHANGED
    
    | @@ -309,6 +309,11 @@ describe Zipcoder do | |
| 309 309 | 
             
                    expect(city_info[:long]).to eq(-97.71)
         | 
| 310 310 | 
             
                  end
         | 
| 311 311 |  | 
| 312 | 
            +
                  it "returns nil if it cant find the city" do
         | 
| 313 | 
            +
                    city_info = "Aus, TX".city_info filter: "78701-78704,78748,13601"
         | 
| 314 | 
            +
                    expect(city_info).to be_nil
         | 
| 315 | 
            +
                  end
         | 
| 316 | 
            +
             | 
| 312 317 | 
             
                  it "returns an nil when the city state is non-existent" do
         | 
| 313 318 | 
             
                    zip_codes = ", ".city_info
         | 
| 314 319 | 
             
                    expect(zip_codes).to be_nil
         |