heycarsten-gcoder 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -6,8 +6,8 @@ begin
6
6
  require 'jeweler'
7
7
  Jeweler::Tasks.new do |g|
8
8
  g.name = 'gcoder'
9
- g.summary = 'A library for geocoding postal codes via the Google Maps ' \
10
- 'Geocoding API with a persisted cache through Tokyo Tyrant'
9
+ g.summary = 'A library for geocoding stuff through the Google Maps ' \
10
+ 'Geocoding API with a persisted cache via Tokyo Tyrant.'
11
11
  g.email = 'heycarsten@gmail.com'
12
12
  g.homepage = 'http://github.com/heycarsten/gcoder'
13
13
  g.authors = ['Carsten Nielsen']
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 3
3
- :patch: 1
3
+ :patch: 2
4
4
  :major: 0
data/gcoder.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{gcoder}
5
- s.version = "0.3.1"
5
+ s.version = "0.3.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Carsten Nielsen"]
9
- s.date = %q{2009-06-27}
9
+ s.date = %q{2009-06-29}
10
10
  s.email = %q{heycarsten@gmail.com}
11
11
  s.extra_rdoc_files = [
12
12
  "README.rdoc"
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
35
35
  s.rdoc_options = ["--charset=UTF-8"]
36
36
  s.require_paths = ["lib"]
37
37
  s.rubygems_version = %q{1.3.1}
38
- s.summary = %q{A library for geocoding postal codes via the Google Maps Geocoding API with a persisted cache through Tokyo Tyrant}
38
+ s.summary = %q{A library for geocoding stuff through the Google Maps Geocoding API with a persisted cache via Tokyo Tyrant.}
39
39
  s.test_files = [
40
40
  "test/config_test.rb",
41
41
  "test/gcoder_test.rb",
@@ -114,7 +114,7 @@ module GCoder
114
114
  :country => {
115
115
  :name => country_name,
116
116
  :code => country_code,
117
- :administrative_area => administrative_area },
117
+ :administrative_area => administrative_area_name },
118
118
  :point => {
119
119
  :longitude => longitude,
120
120
  :latitude => latitude },
@@ -122,44 +122,68 @@ module GCoder
122
122
  end
123
123
 
124
124
  def box
125
- { :north => placemark['ExtendedData']['LatLonBox']['north'],
126
- :south => placemark['ExtendedData']['LatLonBox']['south'],
127
- :east => placemark['ExtendedData']['LatLonBox']['east'],
128
- :west => placemark['ExtendedData']['LatLonBox']['west'] }
125
+ { :north => latlon_box['north'],
126
+ :south => latlon_box['south'],
127
+ :east => latlon_box['east'],
128
+ :west => latlon_box['west'] }
129
129
  end
130
130
 
131
131
  def accuracy
132
- placemark['AddressDetails']['Accuracy']
132
+ address_details['Accuracy']
133
133
  end
134
134
 
135
135
  def latitude
136
- placemark['Point']['coordinates'][1]
136
+ coordinates[1]
137
137
  end
138
138
 
139
139
  def longitude
140
- placemark['Point']['coordinates'][0]
141
- end
142
-
143
- def latlon_box
144
- placemark['ExtendedData']['LatLonBox']
140
+ coordinates[0]
145
141
  end
146
142
 
147
143
  def country_name
148
- placemark['AddressDetails']['Country']['CountryName']
144
+ country['CountryName']
149
145
  end
150
146
 
151
147
  def country_code
152
- placemark['AddressDetails']['Country']['CountryNameCode']
148
+ country['CountryNameCode']
153
149
  end
154
150
 
155
- def administrative_area
156
- placemark['AddressDetails']['Country']['AdministrativeArea']['AdministrativeAreaName']
151
+ def administrative_area_name
152
+ administrative_area['AdministrativeAreaName']
157
153
  end
158
154
 
159
155
  private
160
156
 
157
+ def coordinates
158
+ point['coordinates'] || []
159
+ end
160
+
161
+ def point
162
+ placemark['Point'] || {}
163
+ end
164
+
165
+ def country
166
+ address_details['Country'] || {}
167
+ end
168
+
169
+ def administrative_area
170
+ country['AdministrativeArea'] || {}
171
+ end
172
+
173
+ def address_details
174
+ placemark['AddressDetails'] || {}
175
+ end
176
+
177
+ def latlon_box
178
+ extended_data['LatLonBox'] || {}
179
+ end
180
+
181
+ def extended_data
182
+ placemark['ExtendedData'] || {}
183
+ end
184
+
161
185
  def placemark
162
- @response['Placemark'][0]
186
+ @response['Placemark'][0] || {}
163
187
  end
164
188
 
165
189
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heycarsten-gcoder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Nielsen
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-27 00:00:00 -07:00
12
+ date: 2009-06-29 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -64,7 +64,7 @@ rubyforge_project:
64
64
  rubygems_version: 1.2.0
65
65
  signing_key:
66
66
  specification_version: 2
67
- summary: A library for geocoding postal codes via the Google Maps Geocoding API with a persisted cache through Tokyo Tyrant
67
+ summary: A library for geocoding stuff through the Google Maps Geocoding API with a persisted cache via Tokyo Tyrant.
68
68
  test_files:
69
69
  - test/config_test.rb
70
70
  - test/gcoder_test.rb