Skip to content
Aaron edited this page May 18, 2019 · 2 revisions

This library contains some tools for working with Google's Distance Matrix API.

To find how long it will take to get from Paradise, CA to Chico, CA, you can call:

const string endPoint =
    "https://maps.googleapis.com/maps/api/distancematrix/json?sensor=false&origins=95969&destinations=95928";

// The UnderscoreContractResolver is included in Devlord.Utilities.
using (var client = new ApiCall(endPoint,
    new JsonSerializerSettings { ContractResolver = new UnderscoreContractResolver() }))
{
    var result = client.Execute<DistanceResults>();

    var resultDuration = ParseDuration((string) result.DataItem.GetResult(0).Duration.Text);
    resultDuration.ShouldBeInRange(20, 30);
}
Clone this wiki locally