google_geocoding 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{google_geocoding}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rodrigo Kochenburger"]
12
- s.date = %q{2010-02-24}
12
+ s.date = %q{2010-03-01}
13
13
  s.description = %q{GoogleGeocoding is a small library for performing geocoding using the Google's HTTP geocoding API}
14
14
  s.email = %q{divoxx@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -1,5 +1,9 @@
1
1
  module GoogleGeocoding
2
2
  class Geocoder
3
+ def self.query(address, options = {})
4
+ self.new(options).query(address)
5
+ end
6
+
3
7
  # Creates a new geocoder instance.
4
8
  # @see Geocoder#geocode
5
9
  def initialize(options = {})
@@ -32,13 +32,17 @@ module GoogleGeocoding
32
32
  if failure?
33
33
  raise Errors::ServiceError.build(status_code)
34
34
  else
35
- @data["Placemark"].map do |placemark_data|
35
+ placemarks = []
36
+
37
+ @data["Placemark"].each do |placemark_data|
36
38
  details = placemark_data["AddressDetails"]
37
- coordinates = placemark_data["Point"]["coordinates"][0,2]
39
+ coordinates = placemark_data["Point"]["coordinates"][2..1]
38
40
  accurracy = Integer(details["Accuracy"])
39
41
  placemark = Placemark.new
40
42
  placemark.accurracy = accurracy
41
43
  placemark.coordinates = coordinates
44
+
45
+ next if accurracy >= 9
42
46
 
43
47
  if accurracy >= 1
44
48
  country = details["Country"]
@@ -68,8 +72,9 @@ module GoogleGeocoding
68
72
  end
69
73
  end
70
74
 
71
- placemark
75
+ placemarks << placemark
72
76
  end
77
+ placemarks
73
78
  end
74
79
  end
75
80
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_geocoding
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Kochenburger
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-24 00:00:00 -08:00
12
+ date: 2010-03-01 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency