Skip to content

Commit

Permalink
Merge pull request #1057 from aaronpk/esri-source-country
Browse files Browse the repository at this point in the history
add `source_country` parameter for esri geocoder
  • Loading branch information
alexreisner committed May 26, 2016
2 parents a4e6f66 + c1d8065 commit 4f0be13
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/geocoder/lookups/esri.rb
Expand Up @@ -44,6 +44,7 @@ def query_url_params(query)
end
params[:token] = token
params[:forStorage] = configuration[:for_storage] if configuration[:for_storage]
params[:sourceCountry] = configuration[:source_country] if configuration[:source_country]
params.merge(super)
end

Expand Down
8 changes: 8 additions & 0 deletions test/unit/lookups/esri_test.rb
Expand Up @@ -16,6 +16,14 @@ def test_query_for_geocode
res
end

def test_query_for_geocode_with_source_country
Geocoder.configure(esri: {source_country: 'USA'})
query = Geocoder::Query.new("Bluffton, SC")
lookup = Geocoder::Lookup.get(:esri)
url = lookup.query_url(query)
assert_match /sourceCountry=USA/, url
end

def test_query_for_geocode_with_token_and_for_storage
token = Geocoder::EsriToken.new('xxxxx', Time.now + 1.day)
Geocoder.configure(esri: {token: token, for_storage: true})
Expand Down

0 comments on commit 4f0be13

Please sign in to comment.