andre-geokit 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -8,10 +8,11 @@ The Geokit gem provides:
8
8
  * Rectangular bounds calculations: is a point within a given rectangular bounds?
9
9
  * Heading and midpoint calculations
10
10
 
11
- Combine this with gem with the [geokit-rails plugin](http://github.com/andre/geokit-rails/tree/master) to get location-based finders for your Rails app.
11
+ Combine this gem with the [geokit-rails plugin](http://github.com/andre/geokit-rails/tree/master) to get location-based finders for your Rails app.
12
12
 
13
13
  * Geokit Documentation at Rubyforge [http://geokit.rubyforge.org](http://geokit.rubyforge.org).
14
14
  * Repository at Github: [http://github.com/andre/geokit-gem/tree/master](http://github.com/andre/geokit-gem/tree/master).
15
+ * Follow the Google Group for updates and discussion on Geokit: [http://groups.google.com/group/geokit](http://groups.google.com/group/geokit)
15
16
 
16
17
  ## INSTALL
17
18
 
@@ -159,6 +160,10 @@ geocoders.rb contains all the geocoder implemenations. All the gercoders
159
160
  inherit from a common base (class Geocoder) and implement the private method
160
161
  do_geocode.
161
162
 
163
+ ## GOOGLE GROUP
164
+
165
+ Follow the Google Group for updates and discussion on Geokit: http://groups.google.com/group/geokit
166
+
162
167
  ## LICENSE
163
168
 
164
169
  (The MIT License)
@@ -389,10 +389,10 @@ module Geokit
389
389
  return GeoLoc.new if !res.is_a?(Net::HTTPSuccess)
390
390
  xml = res.body
391
391
  logger.debug "Google geocoding. Address: #{address}. Result: #{xml}"
392
- return self.xml2GeoLoc(xml)
392
+ return self.xml2GeoLoc(xml, address)
393
393
  end
394
394
 
395
- def self.xml2GeoLoc(xml)
395
+ def self.xml2GeoLoc(xml, address="")
396
396
  doc=REXML::Document.new(xml)
397
397
 
398
398
  if doc.elements['//kml/Response/Status/code'].text == '200'
@@ -402,7 +402,7 @@ module Geokit
402
402
  doc.each_element('//Placemark') do |e|
403
403
  extracted_geoloc = extract_placemark(e) # g is now an instance of Geoloc
404
404
  if geoloc.nil?
405
- # first time through, geoloc is still nill, so we make it the geoloc we just extracted
405
+ # first time through, geoloc is still nil, so we make it the geoloc we just extracted
406
406
  geoloc = extracted_geoloc
407
407
  else
408
408
  # second (and subsequent) iterations, we push additional
@@ -383,7 +383,7 @@ module Geokit
383
383
  end
384
384
 
385
385
  def to_yaml_properties
386
- (instance_variables - ['@results']).sort
386
+ (instance_variables - ['@all']).sort
387
387
  end
388
388
 
389
389
  # Returns a string representation of the instance.
data/test/test_geoloc.rb CHANGED
@@ -51,4 +51,14 @@ class GeoLocTest < Test::Unit::TestCase #:nodoc: all
51
51
  assert_equal [@loc], @loc.all
52
52
  end
53
53
 
54
+ def test_to_yaml
55
+ @loc.city = 'San Francisco'
56
+ @loc.state = 'CA'
57
+ @loc.zip = '94105'
58
+ @loc.country_code = 'US'
59
+ assert_equal(
60
+ "--- !ruby/object:Geokit::GeoLoc \ncity: San Francisco\ncountry_code: US\nfull_address: \nlat: \nlng: \nprecision: unknown\nstate: CA\nstreet_address: \nsuccess: false\nzip: \"94105\"\n",
61
+ @loc.to_yaml)
62
+ end
63
+
54
64
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: andre-geokit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andre Lewis and Bill Eisenhauer