From 72c622bf70fca014e524d63ee8ba04bd5a4c7c15 Mon Sep 17 00:00:00 2001
From: Alex Reisner <alex@alexreisner.com>
Date: Mon, 22 Apr 2013 17:22:57 -0400
Subject: [PATCH] Fix incorrect parameter name (ESRI).

---
 lib/geocoder/lookups/esri.rb | 19 ++++++++-----------
 test/services_test.rb        |  2 +-
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/lib/geocoder/lookups/esri.rb b/lib/geocoder/lookups/esri.rb
index cfd37a8a..9acd0b61 100644
--- a/lib/geocoder/lookups/esri.rb
+++ b/lib/geocoder/lookups/esri.rb
@@ -32,20 +32,17 @@ module Geocoder::Lookup
     end
 
     def query_url_params(query)
+      params = {
+        :f => "pjson",
+        :outFields => "*"
+      }
       if query.reverse_geocode?
-        {
-          :location => query.coordinates.reverse.join(','),
-          :outFields => :*,
-          :p => :pjson
-        }.merge(super)
+        params[:location] = query.coordinates.reverse.join(',')
       else
-        {
-          :f => :pjson,
-          :outFields => :*,
-          :text => query.sanitized_text
-        }.merge(super)
+        params[:text] = query.sanitized_text
       end
-    end  
+      params.merge(super)
+    end
 
   end
 end
diff --git a/test/services_test.rb b/test/services_test.rb
index fd0ac300..906f4fd3 100644
--- a/test/services_test.rb
+++ b/test/services_test.rb
@@ -289,7 +289,7 @@ class ServicesTest < Test::Unit::TestCase
     query = Geocoder::Query.new([45.423733, -75.676333])
     lookup = Geocoder::Lookup.get(:esri)
     res = lookup.query_url(query)
-    assert_equal "http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?location=-75.676333%2C45.423733&outFields=%2A&p=pjson",
+    assert_equal "http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&location=-75.676333%2C45.423733&outFields=%2A",
       res
   end
 
-- 
GitLab