aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tom_tom.rb
diff options
context:
space:
mode:
authorTeddy Wing2018-03-12 11:46:03 +0100
committerTeddy Wing2018-03-14 16:38:39 +0100
commitaf4e70fc1c0ef7d74429b0a6507182a6b34ec721 (patch)
treef771e99cd85eebf5b5d7b1d30db5cf6e5ef8fc1c /lib/tom_tom.rb
parentb55fcf26a4b71ad79737bc2a0d291f6ce6944dec (diff)
downloadchouette-core-af4e70fc1c0ef7d74429b0a6507182a6b34ec721.tar.bz2
Revert "TomTom: Add method for `calculateRoute` endpoint"
This reverts commit f28a4b2c5b348bc12b455aa0cd76a9513103aea7. As stated in that commit, I'm going to use the `/batch` endpoint instead of `/calculateRoute` because I know that's already working.
Diffstat (limited to 'lib/tom_tom.rb')
-rw-r--r--lib/tom_tom.rb36
1 files changed, 0 insertions, 36 deletions
diff --git a/lib/tom_tom.rb b/lib/tom_tom.rb
index a2ebeb1a8..4a6a58df0 100644
--- a/lib/tom_tom.rb
+++ b/lib/tom_tom.rb
@@ -14,19 +14,6 @@ class TomTom
end
end
- def calculate_route(way_costs)
- params = URI.encode_www_form({
- travelMode: 'bus',
- routeType: 'shortest'
- })
- locations = convert_way_costs_for_calculate_route(way_costs)
-
- response = @connection.post do |req|
- req.url "/routing/1/calculateRoute/#{locations}/json?#{params}"
- req.headers['Content-Type'] = 'application/json'
- end
- end
-
def batch(way_costs)
params = URI.encode_www_form({
travelMode: 'bus',
@@ -45,16 +32,6 @@ class TomTom
batchItems: batch_items
}.to_json
end
-
- response = JSON.parse(response.body)
-
- calculated_routes = response['batchItems']
-
- calculated_routes.each do |route|
- next if route['statusCode'] != 200
-
- distance = route['response']['routes']
- end
end
def convert_way_costs_for_batch(way_costs)
@@ -63,17 +40,4 @@ class TomTom
":#{way_cost.arrival.lat},#{way_cost.arrival.lng}"
end
end
-
- def convert_way_costs_for_calculate_route(way_costs)
- coordinates = []
-
- way_costs.map do |way_cost|
- coordinates << "#{way_cost.departure.lat},#{way_cost.departure.lng}"
- coordinates << "#{way_cost.arrival.lat},#{way_cost.arrival.lng}"
- end
-
- coordinates
- .uniq
- .join(':')
- end
end