zipcoder 0.8.1 → 0.8.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: d5ea79e54e07f65092ff72021e80e076cba9e348
4
- data.tar.gz: d5193fdcbcb13cb7fa7badf543c02b23027c21e2
3
+ metadata.gz: fde88ab0a0441409d798cf1cb4ec90fb7942a218
4
+ data.tar.gz: 839d0d315be9dbff593cdf0c8938e1e2ec8a9e58
5
5
  SHA512:
6
- metadata.gz: b87a6b2a6fcaa9f2312a933341fb77bdd2c05656a074eb3546b283efd13a9850ab2871d2461dc604df7a8a5289838c10417c730ebdfbcdd590553cb37fedb1d3
7
- data.tar.gz: c68067f063772d7a9e0bb2c3d4752da71f3656cb302a8fafe8b2887dc09a2778a617a9b255b9c21138897c405546c2ef8706247ff3070d927c7687918d90f83b
6
+ metadata.gz: ee21dfd66e245dc4b5a995d33f641a66ad21c9724cca7c2a3c900aa58535c040e573fa8e0b18875440f383aba91197c553d2687af10883171ee127adc0499a63
7
+ data.tar.gz: 952e42c0a34cf2ef62e8b142d9bb54444792045e6bbed3046df869c8f76dfa45ef2012b8be86a004bbac1a5afdaa6e5a4c6c3a7776dc75818d26d558a04f85d6
data/README.md CHANGED
@@ -7,6 +7,8 @@ Gem for performing zip code lookup operations
7
7
 
8
8
  ## Revision History
9
9
 
10
+ - v0.8.2:
11
+ - fixed exception if it can't find the city when "filter" is used
10
12
  - v0.8.1:
11
13
  - added "filter" argument to "city_info" to filter the zip codes
12
14
  - v0.8.0:
@@ -1,3 +1,3 @@
1
1
  module Zipcoder
2
- VERSION = "0.8.1"
2
+ VERSION = "0.8.2"
3
3
  end
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
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zipcoder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Chapman