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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49c25953305b497d054ac7ae74894e1dbb904d1f
4
- data.tar.gz: 749c75ddf3ca5b13fac1c5eb24cc403661edfc04
3
+ metadata.gz: 185681c56839f42b31b957ddbf1c919eb52e7831
4
+ data.tar.gz: cedcdab9cc81c4002bb27bdca93b6bffb24f0173
5
5
  SHA512:
6
- metadata.gz: 38e4aa2429aecaeca3852c527cb256f10160a46984b449752846a8f1f3da3ef6fae1ec5eb2f4b0c816506ae00d7ed270570b7b6986e82d25447e21c3b88e87ec
7
- data.tar.gz: 3f667efd574b1e5a200dfdc0f2a58b5976e46ae808d75cd34bc3daf5686ce9220f639ca464888255ef4f265ec53502019745b18148ecf26352252f3d722b939e
6
+ metadata.gz: 19066cf5e63eb7827e2fd9c08b502c5a29ef6bfd8155e61aa33d2768972d0bc80d70d5974d74dfc27a1502416b29a79b184dd9fb194673e23872f911e435d668
7
+ data.tar.gz: 11d26d94cc20b56e1682b6d590e6def31e650232eee6dc2bf20478c452fd1baf5a9f32edbac5b0e5feba5eaea6f7baf464b0276cf25f3b893addae5abb967aed
@@ -5,4 +5,11 @@ rvm:
5
5
  - 2.1
6
6
  - 2.0.0
7
7
  - jruby-head
8
- - jruby-9000
8
+ - jruby-9000
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: jruby-head
12
+ addons:
13
+ apt:
14
+ packages:
15
+ - libgmp3-dev
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.2
4
+
5
+ * Add nearest roads Google Roads API support
6
+
3
7
  ## 0.4.1
4
8
 
5
9
  * Support JRuby 9.0.0.0
@@ -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
@@ -1,6 +1,6 @@
1
1
  module GoogleMapsService
2
2
  # GoogleMapsService gem version
3
- VERSION = '0.4.1'
3
+ VERSION = '0.4.2'
4
4
 
5
5
  # Current operating system
6
6
  # @private
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.1
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: 2015-09-23 00:00:00.000000000 Z
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.6
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