geocoder 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of geocoder might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f4a9925e759e3cd83f49edbe16d9258f047d4706
4
- data.tar.gz: 647fe2e7bc4731707a75dde07c8eec629622821a
3
+ metadata.gz: 6a87e48d6ef8d83ba7431093b99731ed6488d901
4
+ data.tar.gz: 813db65901b6ce424544968d1cc8c1bfa78425a0
5
5
  SHA512:
6
- metadata.gz: 1515913cc2e937453458d947421278666ffda78d9388480080fb3af5978cd0a7efd89a5272f33fdfb46e9b89899b675d3064b276cf8b8e97091ce6b218d91f7f
7
- data.tar.gz: f76ddc572cfb359718ee5da19451462bfeb442a4986560afb6837444756dcfbaf32d3a36025977d08ab68f9e7f9223ef236ec5c354240932c93b90e42dbb1a3b
6
+ metadata.gz: 99aa2501a9fbc16abe3a0fd7b354b3d29f51653507f463a1692aebb00e1f41b8e3f9b41d1a2e493aadba7f42c44cd66c3082d3e9147732cb1703c92aa11fc354
7
+ data.tar.gz: 64094ce5902e6471e958810e4438feec04f6e9f7a9fdfd99a79262d3d1cf5a8b84196eb57c6ff3343cb2e262d650194ec23adb686f73e31f4df086c601c0656e
@@ -3,8 +3,14 @@ Changelog
3
3
 
4
4
  Major changes to Geocoder for each release. Please see the Git log for complete list of changes.
5
5
 
6
+ 1.2.1 (2014 May 12)
7
+ -------------------
8
+
9
+ * Fix: correctly handle encoding of MaxMind API responses (thanks github.com/hydrozen, gonzoyumo).
10
+ * Fixes to :maxmind_local database structure (thanks github.com/krakatoa).
11
+
6
12
  1.2.0 (2014 Apr 16)
7
- -----------
13
+ -------------------
8
14
 
9
15
  * DROP SUPPORT for Ruby 1.8.x.
10
16
  * Add :here lookup (thanks github.com/christoph-buente).
data/README.md CHANGED
@@ -660,8 +660,12 @@ By default the prefix is `geocoder:`
660
660
 
661
661
  If you need to expire cached content:
662
662
 
663
- Geocoder.cache.expire("http://...") # expire cached result for a URL
664
- Geocoder.cache.expire(:all) # expire all cached results
663
+ Geocoder::Lookup.get(Geocoder.config[:lookup]).cache.expire(:all) # expire cached results for current Lookup
664
+ Geocoder::Lookup.get(:google).cache.expire("http://...") # expire cached result for a specific URL
665
+ Geocoder::Lookup.get(:google).cache.expire(:all) # expire cached results for Google Lookup
666
+ # expire all cached results for all Lookups.
667
+ # Be aware that this methods spawns a new Lookup object for each Service
668
+ Geocoder::Lookup.all_services.each{|service| Geocoder::Lookup.get(service).cache.expire(:all)}
665
669
 
666
670
  Do *not* include the prefix when passing a URL to be expired. Expiring `:all` will only expire keys with the configured prefix (won't kill every entry in your key/value store).
667
671
 
@@ -22,6 +22,7 @@ class GeocoderMaxmindGeoliteCity < ActiveRecord::Migration
22
22
  end
23
23
 
24
24
  def self.down
25
- drop_table :maxmind_geolite_city
25
+ drop_table :maxmind_geolite_city_location
26
+ drop_table :maxmind_geolite_city_blocks
26
27
  end
27
28
  end
@@ -71,7 +71,9 @@ module Geocoder::Lookup
71
71
  end
72
72
 
73
73
  def parse_raw_data(raw_data)
74
- CSV.parse_line raw_data
74
+ # Maxmind just returns text/plain as csv format but according to documentation,
75
+ # we get ISO-8859-1 encoded string. We need to convert it.
76
+ CSV.parse_line raw_data.force_encoding("ISO-8859-1").encode("UTF-8")
75
77
  end
76
78
 
77
79
  def reserved_result
@@ -34,10 +34,10 @@ module Geocoder::Lookup
34
34
  result.nil? ? [] : [result.to_hash]
35
35
  elsif configuration[:package] == :city
36
36
  addr = IPAddr.new(query.text).to_i
37
- q = "SELECT l.country, l.region, l.city
37
+ q = "SELECT l.country, l.region, l.city, l.latitude, l.longitude
38
38
  FROM maxmind_geolite_city_location l JOIN maxmind_geolite_city_blocks b USING (loc_id)
39
39
  WHERE b.start_ip_num <= #{addr} AND #{addr} <= b.end_ip_num"
40
- format_result(q, [:country_name, :region_name, :city_name])
40
+ format_result(q, [:country_name, :region_name, :city_name, :latitude, :longitude])
41
41
  elsif configuration[:package] == :country
42
42
  addr = IPAddr.new(query.text).to_i
43
43
  q = "SELECT country, country_code FROM maxmind_geolite_country
@@ -1,3 +1,3 @@
1
1
  module Geocoder
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -83,7 +83,7 @@ module Geocoder
83
83
  case package
84
84
  when :geolite_city_csv
85
85
  # use the last two in case multiple versions exist
86
- files = Dir.glob(File.join(dir, "GeoLiteCity_*/*.csv"))[-2..-1]
86
+ files = Dir.glob(File.join(dir, "GeoLiteCity_*/*.csv"))[-2..-1].sort
87
87
  Hash[*files.zip(["maxmind_geolite_city_blocks", "maxmind_geolite_city_location"]).flatten]
88
88
  when :geolite_country_csv
89
89
  {File.join(dir, "GeoIPCountryWhois.csv") => "maxmind_geolite_country"}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geocoder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Reisner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-16 00:00:00.000000000 Z
11
+ date: 2014-05-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Provides object geocoding (by street or IP address), reverse geocoding
14
14
  (coordinates to street address), distance queries for ActiveRecord and Mongoid,