gmaps_geocoding 1.2.2 → 1.3.0
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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/.versions.conf +1 -1
- data/lib/gmaps_geocoding.rb +3 -3
- data/lib/gmaps_geocoding/api.rb +14 -19
- data/lib/gmaps_geocoding/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b654b588fdf5b34c21ccd55f008d482b2802fc55
|
4
|
+
data.tar.gz: f28760fb36c8298650297932ca9399b205b57f71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e11a3cda1549a260dc9105cbf68f533b5629add28cdc232e883d3ec70f749b641eeacc1dbb8ce98c967128bb3d03b905ebd7efe4f491c274b3448315d9ce94a1
|
7
|
+
data.tar.gz: b97e32244d58048c295b5de15dba31796a43c0ef23ffb38d03113e11e2ca313c25d4c31924fad112e3ad5bf963d99cb1d22cd1fde321731af527b11636d7910c
|
data/.travis.yml
CHANGED
data/.versions.conf
CHANGED
data/lib/gmaps_geocoding.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
require_relative 'gmaps_geocoding/api'
|
2
|
+
require_relative 'gmaps_geocoding/config'
|
3
|
+
require_relative 'gmaps_geocoding/version'
|
data/lib/gmaps_geocoding/api.rb
CHANGED
@@ -41,16 +41,13 @@ module GmapsGeocoding
|
|
41
41
|
# result = api.location
|
42
42
|
#
|
43
43
|
def location
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
else
|
50
|
-
xml_to_hash(rest_client)
|
51
|
-
end
|
44
|
+
fail 'Invalid configuration parameters check the Google Geocoding API documentation'.freeze unless @config.valid?
|
45
|
+
rest_client = retrieve_geocoding_data
|
46
|
+
case @config.json_format?
|
47
|
+
when true
|
48
|
+
json_to_hash(rest_client)
|
52
49
|
else
|
53
|
-
|
50
|
+
xml_to_hash(rest_client)
|
54
51
|
end
|
55
52
|
rescue => e
|
56
53
|
@logger.error e
|
@@ -95,8 +92,8 @@ module GmapsGeocoding
|
|
95
92
|
tmp_data = data
|
96
93
|
tmp_data = [tmp_data] unless tmp_data.is_a?(Array)
|
97
94
|
tmp_data.each do |d|
|
98
|
-
result[
|
99
|
-
|
95
|
+
result[d['geometry']['location_type']] = { lng: d['geometry']['location']['lng'].to_f,
|
96
|
+
lat: d['geometry']['location']['lat'].to_f }
|
100
97
|
end
|
101
98
|
result
|
102
99
|
end
|
@@ -146,15 +143,13 @@ module GmapsGeocoding
|
|
146
143
|
else
|
147
144
|
result[d.value] = xml_node_to_ruby(d)
|
148
145
|
end
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
result[d.value] = [result[d.value]]
|
153
|
-
end
|
154
|
-
result[d.value] << d.nodes[0]
|
155
|
-
else
|
156
|
-
result[d.value] = d.nodes[0]
|
146
|
+
elsif result.include?(d.value)
|
147
|
+
unless result[d.value].is_a?(Array)
|
148
|
+
result[d.value] = [result[d.value]]
|
157
149
|
end
|
150
|
+
result[d.value] << d.nodes[0]
|
151
|
+
else
|
152
|
+
result[d.value] = d.nodes[0]
|
158
153
|
end
|
159
154
|
end
|
160
155
|
result
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmaps_geocoding
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Kakesa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|