gmaps_geocoding 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/.versions.conf +1 -1
- data/README.md +20 -0
- data/gmaps_geocoding.gemspec +3 -3
- data/lib/gmaps_geocoding/api.rb +3 -3
- data/lib/gmaps_geocoding/config.rb +1 -1
- data/lib/gmaps_geocoding/version.rb +1 -1
- metadata +29 -30
- data/.ruby-version +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4f401cb0948ca4d9487429c2797d7c99f26cf15
|
4
|
+
data.tar.gz: 4634b06d21d151f3090a3322f695f380954950d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 576577ecb16e216c6fb744c510b1cc10c933ef3b1132ed396984e0b3d5ac825158e959f55305edab091d880162345f22dfb540cb2fdfff97056bfb403d9b1dcf
|
7
|
+
data.tar.gz: a0965ae57458ed9671336d737f626ebd53225e8465426b1ceec713a56e3809dc8d930c12c4b6b01b42260d9d378d491854d57c8a5b8f07bb28fa878ba8cee9a0
|
data/.versions.conf
CHANGED
data/README.md
CHANGED
@@ -23,6 +23,7 @@ Or install it yourself as:
|
|
23
23
|
See [Google Maps Geocoding service documentation](https://developers.google.com/maps/documentation/geocoding/) for options parameters and *result* handling.
|
24
24
|
|
25
25
|
All options could be overriden with corresponding environment variable:
|
26
|
+
|
26
27
|
* GOOGLE_MAPS_GEOCODING_OUTPUT
|
27
28
|
* GOOGLE_MAPS_GEOCODING_ADDRESS
|
28
29
|
* GOOGLE_MAPS_GEOCODING_LATLNG
|
@@ -32,6 +33,25 @@ All options could be overriden with corresponding environment variable:
|
|
32
33
|
* GOOGLE_MAPS_GEOCODING_LANGUAGE
|
33
34
|
* GOOGLE_MAPS_GEOCODING_REGION
|
34
35
|
|
36
|
+
### Easy way to use for both JSON and XML format
|
37
|
+
|
38
|
+
opts = {address: 'Tour Eiffel, Paris, IDF, France'}
|
39
|
+
api = GmapsGeocoding::Api.new(opts)
|
40
|
+
data = api.get_location
|
41
|
+
loc = api.get_finest_latlng(data['results']) if data.include?('status') && data['status'].eql?('OK')
|
42
|
+
|
43
|
+
_Return a location array_
|
44
|
+
|
45
|
+
* `loc[0] is the longitude float value`
|
46
|
+
* `loc[1] is the latitude float value`
|
47
|
+
|
48
|
+
`get_finest_latlng` retrieve the best address in this order:
|
49
|
+
|
50
|
+
* _ROOFTOP_
|
51
|
+
* _RANGE_INTERPOLATED_
|
52
|
+
* _GEOMETRIC_CENTER_
|
53
|
+
* _APPROXIMATE_
|
54
|
+
|
35
55
|
### JSON example
|
36
56
|
|
37
57
|
# json output example
|
data/gmaps_geocoding.gemspec
CHANGED
@@ -22,10 +22,10 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.require_paths = ['lib']
|
23
23
|
|
24
24
|
s.add_runtime_dependency 'rest-client', '~> 1.6.7'
|
25
|
-
s.add_runtime_dependency 'yajl-ruby', '~> 1.
|
26
|
-
s.add_runtime_dependency 'nori', '~> 2.
|
25
|
+
s.add_runtime_dependency 'yajl-ruby', '~> 1.2.0'
|
26
|
+
s.add_runtime_dependency 'nori', '~> 2.3.0'
|
27
27
|
s.add_runtime_dependency 'nokogiri', '~> 1.6.0'
|
28
|
-
s.add_development_dependency 'bundler', '~> 1.3
|
28
|
+
s.add_development_dependency 'bundler', '~> 1.5.3'
|
29
29
|
s.add_development_dependency 'rake'
|
30
30
|
s.add_development_dependency 'yard'
|
31
31
|
end
|
data/lib/gmaps_geocoding/api.rb
CHANGED
@@ -11,7 +11,7 @@ module GmapsGeocoding
|
|
11
11
|
attr_reader :config
|
12
12
|
|
13
13
|
def initialize(opts = {})
|
14
|
-
@config = Config.new(opts)
|
14
|
+
@config = GmapsGeocoding::Config.new(opts)
|
15
15
|
end
|
16
16
|
|
17
17
|
# Return a Ruby Hash object of the Google Maps Geocoding Service response
|
@@ -104,7 +104,7 @@ module GmapsGeocoding
|
|
104
104
|
|
105
105
|
def retrieve_geocoding_data
|
106
106
|
require 'rest-client'
|
107
|
-
data = build_url_query
|
107
|
+
data = build_url_query
|
108
108
|
RestClient.get data[:url], params: data[:query]
|
109
109
|
end
|
110
110
|
end
|
@@ -117,7 +117,7 @@ module GmapsGeocoding
|
|
117
117
|
|
118
118
|
def from_xml(xml)
|
119
119
|
require 'nori'
|
120
|
-
result = Nori.new
|
120
|
+
result = Nori.new.parse(xml)
|
121
121
|
if result.include?('GeocodeResponse')
|
122
122
|
result['GeocodeResponse']
|
123
123
|
else
|
@@ -120,7 +120,7 @@ module GmapsGeocoding
|
|
120
120
|
#
|
121
121
|
# According to the specifications: {https://developers.google.com/maps/documentation/geocoding/#GeocodingResponses}
|
122
122
|
def is_output_param_valid?
|
123
|
-
|
123
|
+
%w(json xml).include?(output)
|
124
124
|
end
|
125
125
|
end
|
126
126
|
end
|
metadata
CHANGED
@@ -1,111 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmaps_geocoding
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Kakesa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.6.7
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.6.7
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: yajl-ruby
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: nori
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.
|
47
|
+
version: 2.3.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.
|
54
|
+
version: 2.3.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: nokogiri
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 1.6.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.6.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.3
|
75
|
+
version: 1.5.3
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.3
|
82
|
+
version: 1.5.3
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: yard
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
description: "\n A simple Ruby gem for Google Maps Geocoding API.\n This gem
|
@@ -116,11 +116,10 @@ executables: []
|
|
116
116
|
extensions: []
|
117
117
|
extra_rdoc_files: []
|
118
118
|
files:
|
119
|
-
- .gitignore
|
120
|
-
- .
|
121
|
-
- .
|
122
|
-
- .
|
123
|
-
- .yardopts
|
119
|
+
- ".gitignore"
|
120
|
+
- ".travis.yml"
|
121
|
+
- ".versions.conf"
|
122
|
+
- ".yardopts"
|
124
123
|
- Gemfile
|
125
124
|
- LICENSE.txt
|
126
125
|
- README.md
|
@@ -142,17 +141,17 @@ require_paths:
|
|
142
141
|
- lib
|
143
142
|
required_ruby_version: !ruby/object:Gem::Requirement
|
144
143
|
requirements:
|
145
|
-
- -
|
144
|
+
- - ">="
|
146
145
|
- !ruby/object:Gem::Version
|
147
146
|
version: '0'
|
148
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
148
|
requirements:
|
150
|
-
- -
|
149
|
+
- - ">="
|
151
150
|
- !ruby/object:Gem::Version
|
152
151
|
version: '0'
|
153
152
|
requirements: []
|
154
153
|
rubyforge_project:
|
155
|
-
rubygems_version: 2.
|
154
|
+
rubygems_version: 2.2.2
|
156
155
|
signing_key:
|
157
156
|
specification_version: 4
|
158
157
|
summary: Use Google Geocoding API from Ruby.
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ruby-2.0.0@gmaps_geocoding
|