google_maps_service 0.4.1 → 0.4.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 +8 -1
- data/CHANGELOG.md +4 -0
- data/lib/google_maps_service/apis/roads.rb +37 -0
- data/lib/google_maps_service/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 185681c56839f42b31b957ddbf1c919eb52e7831
|
4
|
+
data.tar.gz: cedcdab9cc81c4002bb27bdca93b6bffb24f0173
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19066cf5e63eb7827e2fd9c08b502c5a29ef6bfd8155e61aa33d2768972d0bc80d70d5974d74dfc27a1502416b29a79b184dd9fb194673e23872f911e435d668
|
7
|
+
data.tar.gz: 11d26d94cc20b56e1682b6d590e6def31e650232eee6dc2bf20478c452fd1baf5a9f32edbac5b0e5feba5eaea6f7baf464b0276cf25f3b893addae5abb967aed
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -104,6 +104,42 @@ module GoogleMapsService::Apis
|
|
104
104
|
custom_response_decoder: method(:extract_roads_body))
|
105
105
|
end
|
106
106
|
|
107
|
+
# Returns the nearest road segments for provided points.
|
108
|
+
# The points passed do not need to be part of a continuous path.
|
109
|
+
#
|
110
|
+
# @example Single point snap
|
111
|
+
# results = client.nearest_roads([40.714728, -73.998672])
|
112
|
+
#
|
113
|
+
# @example Multi points snap
|
114
|
+
# points = [
|
115
|
+
# [-33.8671, 151.20714],
|
116
|
+
# [-33.86708, 151.20683000000002],
|
117
|
+
# [-33.867070000000005, 151.20674000000002],
|
118
|
+
# [-33.86703, 151.20625]
|
119
|
+
# ]
|
120
|
+
# results = client.nearest_roads(points)
|
121
|
+
#
|
122
|
+
# @param [Array] points The points to be used for nearest road segment lookup. Array of latitude/longitude pairs
|
123
|
+
# which do not need to be a part of continuous part.
|
124
|
+
# Takes up to 100 independent coordinates, and returns the closest road segment for each point.
|
125
|
+
#
|
126
|
+
# @return [Array] Array of snapped points.
|
127
|
+
|
128
|
+
def nearest_roads(points)
|
129
|
+
points = GoogleMapsService::Convert.waypoints(points)
|
130
|
+
|
131
|
+
params = {
|
132
|
+
points: points
|
133
|
+
}
|
134
|
+
|
135
|
+
return get('/v1/nearestRoads', params,
|
136
|
+
base_url: ROADS_BASE_URL,
|
137
|
+
accepts_client_id: false,
|
138
|
+
custom_response_decoder: method(:extract_roads_body))[:snappedPoints]
|
139
|
+
end
|
140
|
+
|
141
|
+
|
142
|
+
|
107
143
|
private
|
108
144
|
# Extracts a result from a Roads API HTTP response.
|
109
145
|
def extract_roads_body(response)
|
@@ -146,5 +182,6 @@ module GoogleMapsService::Apis
|
|
146
182
|
raise GoogleMapsService::Error::ApiError.new(response), error[:message]
|
147
183
|
end
|
148
184
|
end
|
185
|
+
|
149
186
|
end
|
150
187
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_maps_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edward Samuel Pasaribu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -107,9 +107,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
109
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.4.
|
110
|
+
rubygems_version: 2.4.5
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: Ruby gem for Google Maps Web Service APIs
|
114
114
|
test_files: []
|
115
|
-
has_rdoc: yard
|