Update mapbox result to use place_name as address #1656
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow up to #1655
Non-nil values are now being returned (when appropriate) for the
city
,state
,state_code
,postal_code
,country
,country_code
, andneighborhood
methods. However, as a result theGeocoder::Result::Mapbox#address
method needs to be updated otherwise the returned value will contain duplicated text.Example: Given that the
city
method now returns a value for "place" type results, a search result for "Chicago, IL" will return "Chicago, Chicago, Illinois, United States". This is because.place_name
and.city
return the same value, and both are being used to build the address.To solve this, we can simply use the
place_name
property on the Mapbox payload as the address rather than building our own.Specs and fixtures have been added to test the different types of results you can get with Mapbox.