rails-geocoder 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +9 -0
- data/README.rdoc +4 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/geocoder.rb +10 -10
- data/rails-geocoder.gemspec +3 -3
- metadata +3 -3
data/CHANGELOG.rdoc
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
Per-release changes to Geocoder.
|
4
4
|
|
5
|
+
== 0.8.3 (2009 Oct 23)
|
6
|
+
|
7
|
+
* Update Google URL query string parameter to reflect recent changes in Google's API.
|
8
|
+
|
9
|
+
== 0.8.2 (2009 Oct 12)
|
10
|
+
|
11
|
+
* Allow a model's geocoder search string method to be something other than an ActiveRecord attribute.
|
12
|
+
* Clean up documentation.
|
13
|
+
|
5
14
|
== 0.8.1 (2009 Oct 8)
|
6
15
|
|
7
16
|
* Extract XML-fetching code from Geocoder.search and place in Geocoder._fetch_xml (for ease of mocking).
|
data/README.rdoc
CHANGED
@@ -18,6 +18,10 @@ or as a gem:
|
|
18
18
|
|
19
19
|
== 2. Configure
|
20
20
|
|
21
|
+
First, you must get a Google Maps API key (to get one go to http://code.google.com/apis/maps/signup.html) and store it in a constant:
|
22
|
+
|
23
|
+
GOOGLE_MAPS_API_KEY = "..."
|
24
|
+
|
21
25
|
To add geocoding features to a class:
|
22
26
|
|
23
27
|
geocoded_by :location
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ begin
|
|
8
8
|
gem.summary = %Q{Add geocoding functionality to Rails models.}
|
9
9
|
gem.description = %Q{Geocoder adds object geocoding and database-agnostic distance calculations to Ruby on Rails. It does not rely on proprietary database functions so finding geocoded objects in a given area is easily done using out-of-the-box MySQL or even SQLite.}
|
10
10
|
gem.email = "alex@alexreisner.com"
|
11
|
-
gem.homepage = "http://
|
11
|
+
gem.homepage = "http://code.alexreisner.com/code/geocoder.html"
|
12
12
|
gem.authors = ["Alex Reisner"]
|
13
13
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
14
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.3
|
data/lib/geocoder.rb
CHANGED
@@ -130,7 +130,7 @@ module Geocoder
|
|
130
130
|
|
131
131
|
##
|
132
132
|
# Fetch coordinates based on the object's location.
|
133
|
-
# Returns an array <tt>[lat,lon]</tt>.
|
133
|
+
# Returns an array <tt>[lat,lon]</tt>.
|
134
134
|
#
|
135
135
|
def fetch_coordinates
|
136
136
|
location = send(self.class.geocoder_options[:method_name])
|
@@ -207,25 +207,25 @@ module Geocoder
|
|
207
207
|
|
208
208
|
##
|
209
209
|
# Query Google for geographic information about the given phrase.
|
210
|
-
# Returns the XML response as a hash. This method is not intended for
|
211
|
-
# general use (prefer Geocoder.search).
|
212
|
-
#
|
213
|
-
# Google's XML document has incorrect encoding (says UTF-8 but is actually
|
214
|
-
# ISO 8859-1). We have to fix this or REXML won't parse it correctly.
|
215
|
-
# This may be fixed in the future; see the bug report at:
|
216
|
-
# http://code.google.com/p/gmaps-api-issues/issues/detail?id=233
|
217
210
|
#
|
218
211
|
def self.search(query)
|
219
212
|
if doc = _fetch_xml(query)
|
220
|
-
REXML::Document.new(doc
|
213
|
+
REXML::Document.new(doc)
|
221
214
|
end
|
222
215
|
end
|
223
216
|
|
224
217
|
##
|
225
218
|
# Request an XML geo search result from Google.
|
219
|
+
# This method is not intended for general use (prefer Geocoder.search).
|
226
220
|
#
|
227
221
|
def self._fetch_xml(query)
|
228
|
-
params = {
|
222
|
+
params = {
|
223
|
+
:q => query,
|
224
|
+
:key => GOOGLE_MAPS_API_KEY,
|
225
|
+
:output => "xml",
|
226
|
+
:sensor => "false",
|
227
|
+
:oe => "utf8"
|
228
|
+
}
|
229
229
|
url = "http://maps.google.com/maps/geo?" + params.to_query
|
230
230
|
|
231
231
|
# Query geocoder and make sure it responds quickly.
|
data/rails-geocoder.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rails-geocoder}
|
8
|
-
s.version = "0.8.
|
8
|
+
s.version = "0.8.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Alex Reisner"]
|
12
|
-
s.date = %q{2009-10-
|
12
|
+
s.date = %q{2009-10-23}
|
13
13
|
s.description = %q{Geocoder adds object geocoding and database-agnostic distance calculations to Ruby on Rails. It does not rely on proprietary database functions so finding geocoded objects in a given area is easily done using out-of-the-box MySQL or even SQLite.}
|
14
14
|
s.email = %q{alex@alexreisner.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
"test/geocoder_test.rb",
|
32
32
|
"test/test_helper.rb"
|
33
33
|
]
|
34
|
-
s.homepage = %q{http://
|
34
|
+
s.homepage = %q{http://code.alexreisner.com/code/geocoder.html}
|
35
35
|
s.rdoc_options = ["--charset=UTF-8"]
|
36
36
|
s.require_paths = ["lib"]
|
37
37
|
s.rubygems_version = %q{1.3.5}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-geocoder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Reisner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-23 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -37,7 +37,7 @@ files:
|
|
37
37
|
- test/geocoder_test.rb
|
38
38
|
- test/test_helper.rb
|
39
39
|
has_rdoc: true
|
40
|
-
homepage: http://
|
40
|
+
homepage: http://code.alexreisner.com/code/geocoder.html
|
41
41
|
licenses: []
|
42
42
|
|
43
43
|
post_install_message:
|