edwardsamuel / google-maps-services-ruby

Ruby gem for Google Maps Web Service APIs
Apache License 2.0
91 stars 52 forks source link

Add support for 'traffic_model' parameter #11

Open jak opened 7 years ago

jak commented 7 years ago

This PR adds support for the traffic_model parameter

From Google's docs:

traffic_model (defaults to best_guess) — Specifies the assumptions to use when calculating time in traffic. This setting affects the value returned in the duration_in_traffic field in the response, which contains the predicted time in traffic based on historical averages. The traffic_model parameter may only be specified for driving directions where the request includes a departure_time, and only if the request includes an API key or a Google Maps APIs Premium Plan client ID. The available values for this parameter are: best_guess (default) indicates that the returned duration_in_traffic should be the best estimate of travel time given what is known about both historical traffic conditions and live traffic. Live traffic becomes more important the closer the departure_time is to now. pessimistic indicates that the returned duration_in_traffic should be longer than the actual travel time on most days, though occasional days with particularly bad traffic conditions may exceed this value. optimistic indicates that the returned duration_in_traffic should be shorter than the actual travel time on most days, though occasional days with particularly good traffic conditions may be faster than this value. The default value of best_guess will give the most useful predictions for the vast majority of use cases. The best_guess travel time prediction may be shorter than optimistic, or alternatively, longer than pessimistic, due to the way the best_guess prediction model integrates live traffic information.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 7af6d4cde427d48b21f09ce1032062adcb34c02a on jak:add-traffic-model-parameter-to-directions into 46746fd72e90c75855baa88aee04e41c84ff32c9 on edwardsamuel:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 7af6d4cde427d48b21f09ce1032062adcb34c02a on jak:add-traffic-model-parameter-to-directions into 46746fd72e90c75855baa88aee04e41c84ff32c9 on edwardsamuel:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 82724305a13cb7b86711d8b970449636e0149564 on jak:add-traffic-model-parameter-to-directions into 46746fd72e90c75855baa88aee04e41c84ff32c9 on edwardsamuel:master.

jak commented 7 years ago

Hi @edwardsamuel

Have you got any feedback for the PR?

Thanks

alexander-saratovcev commented 3 years ago

Hi @edwardsamuel , any updates here, do you have a plan to include this implementation in the release?