-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow speed_unit to be passed to request #7
base: master
Are you sure you want to change the base?
Changes from 2 commits
4e86596
3a75f10
684c512
ce77462
02973b7
9c20a42
7493b02
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,8 +63,9 @@ def snap_to_roads(path, interpolate: false) | |
# by the snap_to_roads function. You can pass up to 100 Place IDs. | ||
# | ||
# @return [Array] Array of speed limits. | ||
def speed_limits(place_ids) | ||
def speed_limits(place_ids, speed_unit='KPH') | ||
params = GoogleMapsService::Convert.as_list(place_ids).map { |place_id| ['placeId', place_id] } | ||
params << ['units', speed_unit] if speed_unit == 'MPH' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as before, to keep it similar to other methods There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this situation, params is an array.
Fyi, when i converted the params to a hash and added the units as a symbol, it created problems. Therefore I went with |
||
|
||
return get('/v1/speedLimits', params, | ||
base_url: ROADS_BASE_URL, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to use
units
, instead ofspeed_unit
. Here I want to keep the params similar to the Google Maps request params name.And also, please use
:
, instead of=
, to keep consistent with other methods.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is
snapped_speed_limits
method that can acceptunits
also, do you mind to add this for that method?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think your example in the PR description can be put in the method example here, so it will be in documentation also :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing. I will update this later today so you can check it over! Thanks for the gem btw. Very useful.