aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/tom_tom/matrix.rb6
-rw-r--r--spec/lib/tom_tom/matrix_spec.rb15
2 files changed, 15 insertions, 6 deletions
diff --git a/lib/tom_tom/matrix.rb b/lib/tom_tom/matrix.rb
index 857c76b2f..e0ee566b6 100644
--- a/lib/tom_tom/matrix.rb
+++ b/lib/tom_tom/matrix.rb
@@ -52,11 +52,11 @@ module TomTom
end
def points_as_params(points)
- points.map do |latlng|
+ points.map do |point|
{
point: {
- latitude: latlng.lat,
- longitude: latlng.lng
+ latitude: point.coordinates.lat,
+ longitude: point.coordinates.lng
}
}
end
diff --git a/spec/lib/tom_tom/matrix_spec.rb b/spec/lib/tom_tom/matrix_spec.rb
index 1cb47752d..b27d99a64 100644
--- a/spec/lib/tom_tom/matrix_spec.rb
+++ b/spec/lib/tom_tom/matrix_spec.rb
@@ -38,9 +38,18 @@ RSpec.describe TomTom::Matrix do
describe "#points_as_params" do
it "transforms a set of LatLng points into a hash for use by TomTom Matrix" do
points = Set.new([
- Geokit::LatLng.new(48.85086, 2.36143),
- Geokit::LatLng.new(47.91231, 1.87606),
- Geokit::LatLng.new(52.50867, 13.42879)
+ TomTom::Matrix::Point.new(
+ Geokit::LatLng.new(48.85086, 2.36143),
+ '44'
+ ),
+ TomTom::Matrix::Point.new(
+ Geokit::LatLng.new(47.91231, 1.87606),
+ '77'
+ ),
+ TomTom::Matrix::Point.new(
+ Geokit::LatLng.new(52.50867, 13.42879),
+ '88'
+ )
])
expect(