aboutsummaryrefslogtreecommitdiffstats
path: root/spec/fixtures
diff options
context:
space:
mode:
authorTeddy Wing2018-03-23 12:26:04 +0100
committerTeddy Wing2018-03-27 16:46:18 +0200
commit4bc33f14a148feb4056db1a2839303b07c67a6b3 (patch)
tree7e0c057da62ed5efb6d2376bd1e45726b2a79e25 /spec/fixtures
parentd3ab2606ffd3dcb94a27d7b4e7c899f1238d3a53 (diff)
downloadchouette-core-4bc33f14a148feb4056db1a2839303b07c67a6b3.tar.bz2
Add `TomTom::Matrix`
A new component to the `TomTom` module that asks TomTom's Matrix API endpoint (https://developer.tomtom.com/online-routing/online-routing-documentation/matrix-routing) to compute `WayCost`s. The matrix API will give us all costs between each pair of coordinates. This will enable us to provide costs for any combination of points in a journey pattern. Given a list of `WayCost`s, it will send all points from those costs to the matrix API and return a list of all non-zero `WayCost`s between all pairs of coordinates. `points_from_way_costs()` extracts unique coordinates from the `WayCost`s. `points_as_params()` builds a list of points in the format expected by the matrix API. The response from the matrix API is formatted as a two-dimensional array consisting of rows and columns that pair each "origin" point with each "destination" point. We loop through this matrix and construct new `WayCost` objects for each pair of coordinates. At the moment, I haven't figured out how I want to save `WayCost` IDs when creating the new pairs. Leaving that for later. Refs #6222
Diffstat (limited to 'spec/fixtures')
-rw-r--r--spec/fixtures/tom_tom_matrix.json123
1 files changed, 123 insertions, 0 deletions
diff --git a/spec/fixtures/tom_tom_matrix.json b/spec/fixtures/tom_tom_matrix.json
new file mode 100644
index 000000000..30048576c
--- /dev/null
+++ b/spec/fixtures/tom_tom_matrix.json
@@ -0,0 +1,123 @@
+{
+ "formatVersion": "0.0.1",
+ "matrix": [
+ [
+ {
+ "statusCode": 200,
+ "response": {
+ "routeSummary": {
+ "lengthInMeters": 0,
+ "travelTimeInSeconds": 0,
+ "trafficDelayInSeconds": 0,
+ "departureTime": "2018-03-23T11:20:17+01:00",
+ "arrivalTime": "2018-03-23T11:20:17+01:00"
+ }
+ }
+ },
+ {
+ "statusCode": 200,
+ "response": {
+ "routeSummary": {
+ "lengthInMeters": 117947,
+ "travelTimeInSeconds": 8356,
+ "trafficDelayInSeconds": 0,
+ "departureTime": "2018-03-23T11:20:17+01:00",
+ "arrivalTime": "2018-03-23T13:39:32+01:00"
+ }
+ }
+ },
+ {
+ "statusCode": 200,
+ "response": {
+ "routeSummary": {
+ "lengthInMeters": 999088,
+ "travelTimeInSeconds": 62653,
+ "trafficDelayInSeconds": 298,
+ "departureTime": "2018-03-23T11:20:17+01:00",
+ "arrivalTime": "2018-03-24T04:44:30+01:00"
+ }
+ }
+ }
+ ],
+ [
+ {
+ "statusCode": 200,
+ "response": {
+ "routeSummary": {
+ "lengthInMeters": 117231,
+ "travelTimeInSeconds": 9729,
+ "trafficDelayInSeconds": 0,
+ "departureTime": "2018-03-23T11:20:17+01:00",
+ "arrivalTime": "2018-03-23T14:02:25+01:00"
+ }
+ }
+ },
+ {
+ "statusCode": 200,
+ "response": {
+ "routeSummary": {
+ "lengthInMeters": 0,
+ "travelTimeInSeconds": 0,
+ "trafficDelayInSeconds": 0,
+ "departureTime": "2018-03-23T11:20:17+01:00",
+ "arrivalTime": "2018-03-23T11:20:17+01:00"
+ }
+ }
+ },
+ {
+ "statusCode": 200,
+ "response": {
+ "routeSummary": {
+ "lengthInMeters": 1114635,
+ "travelTimeInSeconds": 72079,
+ "trafficDelayInSeconds": 298,
+ "departureTime": "2018-03-23T11:20:18+01:00",
+ "arrivalTime": "2018-03-24T07:21:36+01:00"
+ }
+ }
+ }
+ ],
+ [
+ {
+ "statusCode": 200,
+ "response": {
+ "routeSummary": {
+ "lengthInMeters": 997232,
+ "travelTimeInSeconds": 63245,
+ "trafficDelayInSeconds": 179,
+ "departureTime": "2018-03-23T11:20:18+01:00",
+ "arrivalTime": "2018-03-24T04:54:23+01:00"
+ }
+ }
+ },
+ {
+ "statusCode": 200,
+ "response": {
+ "routeSummary": {
+ "lengthInMeters": 1113108,
+ "travelTimeInSeconds": 68485,
+ "trafficDelayInSeconds": 52,
+ "departureTime": "2018-03-23T11:20:18+01:00",
+ "arrivalTime": "2018-03-24T06:21:43+01:00"
+ }
+ }
+ },
+ {
+ "statusCode": 200,
+ "response": {
+ "routeSummary": {
+ "lengthInMeters": 344,
+ "travelTimeInSeconds": 109,
+ "trafficDelayInSeconds": 0,
+ "departureTime": "2018-03-23T11:20:18+01:00",
+ "arrivalTime": "2018-03-23T11:22:07+01:00"
+ }
+ }
+ }
+ ]
+ ],
+ "summary": {
+ "successfulRoutes": 9,
+ "totalRoutes": 9
+ }
+}