geocoder 1.5.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +23 -2
  3. data/LICENSE +1 -1
  4. data/README.md +15 -17
  5. data/examples/autoexpire_cache_redis.rb +2 -0
  6. data/lib/geocoder/calculations.rb +1 -1
  7. data/lib/geocoder/ip_address.rb +13 -0
  8. data/lib/geocoder/lookup.rb +6 -4
  9. data/lib/geocoder/lookups/baidu_ip.rb +1 -1
  10. data/lib/geocoder/lookups/ban_data_gouv_fr.rb +13 -0
  11. data/lib/geocoder/lookups/base.rb +7 -2
  12. data/lib/geocoder/lookups/bing.rb +2 -1
  13. data/lib/geocoder/lookups/esri.rb +38 -13
  14. data/lib/geocoder/lookups/freegeoip.rb +7 -7
  15. data/lib/geocoder/lookups/here.rb +28 -22
  16. data/lib/geocoder/lookups/ip2location.rb +7 -14
  17. data/lib/geocoder/lookups/ipapi_com.rb +2 -1
  18. data/lib/geocoder/lookups/ipdata_co.rb +5 -4
  19. data/lib/geocoder/lookups/ipgeolocation.rb +51 -0
  20. data/lib/geocoder/lookups/ipinfo_io.rb +2 -11
  21. data/lib/geocoder/lookups/ipregistry.rb +68 -0
  22. data/lib/geocoder/lookups/ipstack.rb +2 -2
  23. data/lib/geocoder/lookups/maxmind.rb +2 -2
  24. data/lib/geocoder/lookups/maxmind_geoip2.rb +4 -7
  25. data/lib/geocoder/lookups/osmnames.rb +57 -0
  26. data/lib/geocoder/lookups/pelias.rb +2 -3
  27. data/lib/geocoder/lookups/pickpoint.rb +1 -1
  28. data/lib/geocoder/lookups/pointpin.rb +3 -3
  29. data/lib/geocoder/lookups/smarty_streets.rb +13 -3
  30. data/lib/geocoder/lookups/telize.rb +2 -2
  31. data/lib/geocoder/lookups/tencent.rb +59 -0
  32. data/lib/geocoder/lookups/yandex.rb +2 -2
  33. data/lib/geocoder/query.rb +14 -0
  34. data/lib/geocoder/railtie.rb +1 -1
  35. data/lib/geocoder/results/baidu.rb +0 -4
  36. data/lib/geocoder/results/ban_data_gouv_fr.rb +1 -1
  37. data/lib/geocoder/results/here.rb +4 -1
  38. data/lib/geocoder/results/ipgeolocation.rb +59 -0
  39. data/lib/geocoder/results/ipregistry.rb +308 -0
  40. data/lib/geocoder/results/osmnames.rb +56 -0
  41. data/lib/geocoder/results/smarty_streets.rb +48 -18
  42. data/lib/geocoder/results/tencent.rb +72 -0
  43. data/lib/geocoder/sql.rb +4 -4
  44. data/lib/geocoder/stores/active_record.rb +1 -1
  45. data/lib/geocoder/version.rb +1 -1
  46. data/lib/hash_recursive_merge.rb +1 -2
  47. data/lib/maxmind_database.rb +3 -3
  48. metadata +12 -13
  49. data/lib/geocoder/lookups/geocoder_us.rb +0 -51
  50. data/lib/geocoder/lookups/mapzen.rb +0 -15
  51. data/lib/geocoder/results/geocoder_us.rb +0 -39
  52. data/lib/geocoder/results/mapzen.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 48d97270ff2c0f4e7920eeb7bbab54348485d101
4
- data.tar.gz: 1a446c88e27b5257bd1c39815890392700e303b1
2
+ SHA256:
3
+ metadata.gz: 25d03f1aeb92b80a0ec269a1f42093bb641e468d0824d324ad5157ed9cfcb559
4
+ data.tar.gz: 1a23a47bfb3d4af0de14421f8b1b76e03234aee309a8be7ddb2acd91ce04c30d
5
5
  SHA512:
6
- metadata.gz: d95f68de9056c0db319dbe6781e993a72ce98db3042e46fb4175ca76fa621e56def1a4bbc8594fed25a87f74f6887849c4cccb98b816765cac48e06c7e1467a8
7
- data.tar.gz: 6a3439cbc7e28bc5c53b7b76b97bdfcf5d30040b74e2302ed11db60b79f9265953bc6b4437977b94995994f596a81a1968fa420d0640b2ad9a5393a6846c6d03
6
+ metadata.gz: e8f4fd2a60fa6ccb91f7a04a737b5720aa4e276181c202b215b5dd8c50b1746d833ace8c2a034aae1282132e62f96be518b3b366c34f03c73ffcb4cf1dd3c6ab
7
+ data.tar.gz: 848c835773fd172b8469eefc28646c4c5cd3176d10bfb175f5d447bd24b51982555644b7ff5d45eddb2bc04cf7820fadb2363a23cf907ad13aa930f33b5dad09
data/CHANGELOG.md CHANGED
@@ -3,10 +3,31 @@ Changelog
3
3
 
4
4
  Major changes to Geocoder for each release. Please see the Git log for complete list of changes.
5
5
 
6
- 1.5.0 (2018 Aug 1)
6
+ 1.6.1 (2020 Jan 23)
7
7
  -------------------
8
+ * Sanitize lat/lon values passed to within_bounding_box to prevent SQL injection.
9
+
10
+ 1.6.0 (2020 Jan 6)
11
+ -------------------
12
+ * Drop support for Rails 3.x.
13
+ * Add support for :osmnames lookup (thanks github.com/zacviandier).
14
+ * Add support for :ipgeolocation IP lookup (thanks github.com/ahsannawaz111).
15
+
16
+ 1.5.2 (2019 Oct 3)
17
+ -------------------
18
+ * Add support for :ipregistry lookup (thanks github.com/ipregistry).
19
+ * Various fixes for Yandex lookup.
20
+
21
+ 1.5.1 (2019 Jan 23)
22
+ -------------------
23
+ * Add support for :tencent lookup (thanks github.com/Anders-E).
24
+ * Add support for :smarty_streets international API (thanks github.com/ankane).
25
+ * Remove :mapzen lookup.
26
+
27
+ 1.5.0 (2018 Jul 31)
28
+ -------------------
29
+ * Drop support for Ruby <2.0.
8
30
  * Change default street address lookup from :google to :nominatim.
9
- * Drop support for Ruby 1.9.
10
31
  * Cache keys no longer include API credentials. This means many entries in existing cache implementations will be invalidated.
11
32
  * Test lookup fixtures should now return `coordinates` and NOT `latitude`/`longitude` attributes (see #1258). This may break some people's tests.
12
33
  * Add support for :ip2location lookup (thanks github.com/ip2location).
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009-11 Alex Reisner
1
+ Copyright (c) 2009-2020 Alex Reisner
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,29 +1,27 @@
1
1
  Geocoder
2
2
  ========
3
3
 
4
- **A complete geocoding solution for Ruby.**
4
+ **Complete geocoding solution for Ruby.**
5
5
 
6
6
  [![Gem Version](https://badge.fury.io/rb/geocoder.svg)](http://badge.fury.io/rb/geocoder)
7
7
  [![Code Climate](https://codeclimate.com/github/alexreisner/geocoder/badges/gpa.svg)](https://codeclimate.com/github/alexreisner/geocoder)
8
8
  [![Build Status](https://travis-ci.org/alexreisner/geocoder.svg?branch=master)](https://travis-ci.org/alexreisner/geocoder)
9
- [![GitHub Issues](https://img.shields.io/github/issues/alexreisner/geocoder.svg)](https://github.com/alexreisner/geocoder/issues)
10
- [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
11
9
 
12
10
  Key features:
13
11
 
14
- * Forward and reverse geocoding, and IP address geocoding.
12
+ * Forward and reverse geocoding.
13
+ * IP address geocoding.
15
14
  * Connects to more than 40 APIs worldwide.
16
- * Performance-enhancing feaures like caching.
17
- * Advanced configuration allows different parameters and APIs to be used in different conditions.
15
+ * Performance-enhancing features like caching.
18
16
  * Integrates with ActiveRecord and Mongoid.
19
17
  * Basic geospatial queries: search within radius (or rectangle, or ring).
20
18
 
21
19
  Compatibility:
22
20
 
23
- * Supports multiple Ruby versions: Ruby 2.x, and JRuby.
24
- * Supports multiple databases: MySQL, PostgreSQL, SQLite, and MongoDB (1.7.0 and higher).
25
- * Supports Rails 3, 4, and 5. If you need to use it with Rails 2 please see the `rails2` branch (no longer maintained, limited feature set).
26
- * Works very well outside of Rails, you just need to install either the `json` (for MRI) or `json_pure` (for JRuby) gem.
21
+ * Ruby versions: 2.x, and JRuby.
22
+ * Databases: MySQL, PostgreSQL, SQLite, and MongoDB.
23
+ * Rails: 4, 5, and 6.
24
+ * Works outside of Rails with the `json` (for MRI) or `json_pure` (for JRuby) gem.
27
25
 
28
26
 
29
27
  Table of Contents
@@ -45,7 +43,7 @@ Advanced Features:
45
43
  * [Geospatial Calculations](#geospatial-calculations)
46
44
  * [Batch Geocoding](#batch-geocoding)
47
45
  * [Testing](#testing)
48
- * [Error Handling](#error-handing)
46
+ * [Error Handling](#error-handling)
49
47
  * [Command Line Interface](#command-line-interface)
50
48
 
51
49
  The Rest:
@@ -224,15 +222,15 @@ Some common options are:
224
222
  Please see [`lib/geocoder/configuration.rb`](https://github.com/alexreisner/geocoder/blob/master/lib/geocoder/configuration.rb) for a complete list of configuration options. Additionally, some lookups have their own special configuration options which are directly supported by Geocoder. For example, to specify a value for Google's `bounds` parameter:
225
223
 
226
224
  # with Google:
227
- Geocoder.search("Paris", bounds: [[32.1,-95.9], [33.9,-94.3]])
225
+ Geocoder.search("Middletown", bounds: [[40.6,-77.9], [39.9,-75.9]])
228
226
 
229
227
  Please see the [source code for each lookup](https://github.com/alexreisner/geocoder/tree/master/lib/geocoder/lookups) to learn about directly supported parameters. Parameters which are not directly supported can be specified using the `:params` option, which appends options to the query string of the geocoding request. For example:
230
228
 
231
229
  # Nominatim's `countrycodes` parameter:
232
- Geocoder.search("Paris", params: {countrycodes: "gb,de,fr,es,us"})
230
+ Geocoder.search("Rome", params: {countrycodes: "us,ca"})
233
231
 
234
232
  # Google's `region` parameter:
235
- Geocoder.search("Paris", params: {region: "..."})
233
+ Geocoder.search("Rome", params: {region: "..."})
236
234
 
237
235
  ### Configuring Multiple Services
238
236
 
@@ -500,9 +498,9 @@ To avoid exceeding per-day limits you can add a `LIMIT` option. However, this wi
500
498
  Testing
501
499
  -------
502
500
 
503
- When writing tests for an app that uses Geocoder it may be useful to avoid network calls and have Geocoder return consistent, configurable results. To do this, configure the `:test` lookup:
501
+ When writing tests for an app that uses Geocoder it may be useful to avoid network calls and have Geocoder return consistent, configurable results. To do this, configure the `:test` lookup and/or `:ip_lookup`
504
502
 
505
- Geocoder.configure(lookup: :test)
503
+ Geocoder.configure(lookup: :test, ip_lookup: :test)
506
504
 
507
505
  Add stubs to define the results that will be returned:
508
506
 
@@ -703,4 +701,4 @@ For all contributions, please respect the following guidelines:
703
701
  * If your pull request is merged, please do not ask for an immediate release of the gem. There are many factors contributing to when releases occur (remember that they affect thousands of apps with Geocoder in their Gemfiles). If necessary, please install from the Github source until the next official release.
704
702
 
705
703
 
706
- Copyright (c) 2009-18 Alex Reisner, released under the MIT license.
704
+ Copyright :copyright: 2009-2020 Alex Reisner, released under the MIT license.
@@ -1,6 +1,8 @@
1
1
  # This class implements a cache with simple delegation to the Redis store, but
2
2
  # when it creates a key/value pair, it also sends an EXPIRE command with a TTL.
3
3
  # It should be fairly simple to do the same thing with Memcached.
4
+ # Alternatively, this class could inherit from Redis, which would make most
5
+ # of the below methods unnecessary.
4
6
  class AutoexpireCacheRedis
5
7
  def initialize(store, ttl = 86400)
6
8
  @store = store
@@ -154,7 +154,7 @@ module Geocoder
154
154
  # Translate a bearing (float) into a compass direction (string, eg "North").
155
155
  #
156
156
  def compass_point(bearing, points = COMPASS_POINTS)
157
- seg_size = 360 / points.size
157
+ seg_size = 360.0 / points.size
158
158
  points[((bearing + (seg_size / 2)) % 360) / seg_size]
159
159
  end
160
160
 
@@ -1,11 +1,24 @@
1
1
  require 'resolv'
2
2
  module Geocoder
3
3
  class IpAddress < String
4
+ PRIVATE_IPS = [
5
+ '10.0.0.0/8',
6
+ '172.16.0.0/12',
7
+ '192.168.0.0/16',
8
+ ].map { |ip| IPAddr.new(ip) }.freeze
9
+
10
+ def internal?
11
+ loopback? || private?
12
+ end
4
13
 
5
14
  def loopback?
6
15
  valid? and !!(self == "0.0.0.0" or self.match(/\A127\./) or self == "::1")
7
16
  end
8
17
 
18
+ def private?
19
+ valid? && PRIVATE_IPS.any? { |ip| ip.include?(self) }
20
+ end
21
+
9
22
  def valid?
10
23
  !!((self =~ Resolv::IPv4::Regex) || (self =~ Resolv::IPv6::Regex))
11
24
  end
@@ -32,17 +32,16 @@ module Geocoder
32
32
  :google_places_search,
33
33
  :bing,
34
34
  :geocoder_ca,
35
- :geocoder_us,
36
35
  :yandex,
37
36
  :nominatim,
38
37
  :mapbox,
39
38
  :mapquest,
40
- :mapzen,
41
39
  :opencagedata,
42
40
  :pelias,
43
41
  :pickpoint,
44
42
  :here,
45
43
  :baidu,
44
+ :tencent,
46
45
  :geocodio,
47
46
  :smarty_streets,
48
47
  :postcode_anywhere_uk,
@@ -51,7 +50,8 @@ module Geocoder
51
50
  :ban_data_gouv_fr,
52
51
  :test,
53
52
  :latlon,
54
- :amap
53
+ :amap,
54
+ :osmnames
55
55
  ]
56
56
  end
57
57
 
@@ -69,11 +69,13 @@ module Geocoder
69
69
  :pointpin,
70
70
  :maxmind_geoip2,
71
71
  :ipinfo_io,
72
+ :ipregistry,
72
73
  :ipapi_com,
73
74
  :ipdata_co,
74
75
  :db_ip_com,
75
76
  :ipstack,
76
- :ip2location
77
+ :ip2location,
78
+ :ipgeolocation
77
79
  ]
78
80
  end
79
81
 
@@ -1,4 +1,4 @@
1
- require 'geocoder/lookups/base'
1
+ require 'geocoder/lookups/baidu'
2
2
  require 'geocoder/results/baidu_ip'
3
3
 
4
4
  module Geocoder::Lookup
@@ -86,6 +86,12 @@ module Geocoder::Lookup
86
86
  unless (citycode = query.options[:citycode]).nil? || !code_param_is_valid?(citycode)
87
87
  params[:citycode] = citycode.to_s
88
88
  end
89
+ unless (lat = query.options[:lat]).nil? || !latitude_is_valid?(lat)
90
+ params[:lat] = lat
91
+ end
92
+ unless (lon = query.options[:lon]).nil? || !longitude_is_valid?(lon)
93
+ params[:lon] = lon
94
+ end
89
95
  params
90
96
  end
91
97
 
@@ -126,5 +132,12 @@ module Geocoder::Lookup
126
132
  (1..99999).include?(param.to_i)
127
133
  end
128
134
 
135
+ def latitude_is_valid?(param)
136
+ param.to_f <= 90 && param.to_f >= -90
137
+ end
138
+
139
+ def longitude_is_valid?(param)
140
+ param.to_f <= 180 && param.to_f >= -180
141
+ end
129
142
  end
130
143
  end
@@ -164,7 +164,7 @@ module Geocoder
164
164
  def cache_key_params(query)
165
165
  # omit api_key and token because they may vary among requests
166
166
  query_url_params(query).reject do |key,value|
167
- key.to_s.match /(key|token)/
167
+ key.to_s.match(/(key|token)/)
168
168
  end
169
169
  end
170
170
 
@@ -197,6 +197,8 @@ module Geocoder
197
197
  raise_error(err) or Geocoder.log(:warn, "Geocoding API connection cannot be established.")
198
198
  rescue Errno::ECONNREFUSED => err
199
199
  raise_error(err) or Geocoder.log(:warn, "Geocoding API connection refused.")
200
+ rescue Geocoder::NetworkError => err
201
+ raise_error(err) or Geocoder.log(:warn, "Geocoding API connection is either unreacheable or reset by the peer")
200
202
  rescue Timeout::Error => err
201
203
  raise_error(err) or Geocoder.log(:warn, "Geocoding API not responding fast enough " +
202
204
  "(use Geocoder.configure(:timeout => ...) to set limit).")
@@ -209,7 +211,10 @@ module Geocoder
209
211
  JSON.parse(data)
210
212
  end
211
213
  rescue
212
- raise_error(ResponseParseError.new(data)) or Geocoder.log(:warn, "Geocoding API's response was not valid JSON: #{data}")
214
+ unless raise_error(ResponseParseError.new(data))
215
+ Geocoder.log(:warn, "Geocoding API's response was not valid JSON")
216
+ Geocoder.log(:debug, "Raw response: #{data}")
217
+ end
213
218
  end
214
219
 
215
220
  ##
@@ -53,7 +53,8 @@ module Geocoder::Lookup
53
53
 
54
54
  def query_url_params(query)
55
55
  {
56
- key: configuration.api_key
56
+ key: configuration.api_key,
57
+ language: (query.language || configuration.language)
57
58
  }.merge(super)
58
59
  end
59
60
 
@@ -40,31 +40,56 @@ module Geocoder::Lookup
40
40
  else
41
41
  params[:text] = query.sanitized_text
42
42
  end
43
- params[:token] = token
44
- params[:forStorage] = configuration[:for_storage] if configuration[:for_storage]
43
+
44
+ params[:token] = token(query)
45
+
46
+ if for_storage_value = for_storage(query)
47
+ params[:forStorage] = for_storage_value
48
+ end
45
49
  params[:sourceCountry] = configuration[:source_country] if configuration[:source_country]
46
50
  params.merge(super)
47
51
  end
48
52
 
49
- def token
50
- create_and_save_token! if !valid_token_configured? and configuration.api_key
51
- configuration[:token].to_s unless configuration[:token].nil?
53
+ def for_storage(query)
54
+ if query.options.has_key?(:for_storage)
55
+ query.options[:for_storage]
56
+ else
57
+ configuration[:for_storage]
58
+ end
59
+ end
60
+
61
+ def token(query)
62
+ token_instance = if query.options[:token]
63
+ query.options[:token]
64
+ else
65
+ configuration[:token]
66
+ end
67
+
68
+ if !valid_token_configured?(token_instance) && configuration.api_key
69
+ token_instance = create_and_save_token!(query)
70
+ end
71
+
72
+ token_instance.to_s unless token_instance.nil?
52
73
  end
53
74
 
54
- def valid_token_configured?
55
- !configuration[:token].nil? and configuration[:token].active?
75
+ def valid_token_configured?(token_instance)
76
+ !token_instance.nil? && token_instance.active?
56
77
  end
57
78
 
58
- def create_and_save_token!
59
- save_token!(create_token)
79
+ def create_and_save_token!(query)
80
+ token_instance = create_token
81
+
82
+ if query.options[:token]
83
+ query.options[:token] = token_instance
84
+ else
85
+ Geocoder.merge_into_lookup_config(:esri, token: token_instance)
86
+ end
87
+
88
+ token_instance
60
89
  end
61
90
 
62
91
  def create_token
63
92
  Geocoder::EsriToken.generate_token(*configuration.api_key)
64
93
  end
65
-
66
- def save_token!(token_instance)
67
- Geocoder.merge_into_lookup_config(:esri, token: token_instance)
68
- end
69
94
  end
70
95
  end
@@ -7,10 +7,10 @@ module Geocoder::Lookup
7
7
  def name
8
8
  "FreeGeoIP"
9
9
  end
10
-
10
+
11
11
  def supported_protocols
12
12
  if configuration[:host]
13
- [:http, :https]
13
+ [:https]
14
14
  else
15
15
  # use https for default host
16
16
  [:https]
@@ -32,8 +32,8 @@ module Geocoder::Lookup
32
32
  end
33
33
 
34
34
  def results(query)
35
- # don't look up a loopback address, just return the stored result
36
- return [reserved_result(query.text)] if query.loopback_ip_address?
35
+ # don't look up a loopback or private address, just return the stored result
36
+ return [reserved_result(query.text)] if query.internal_ip_address?
37
37
  # note: Freegeoip.net returns plain text "Not Found" on bad request
38
38
  (doc = fetch_data(query)) ? [doc] : []
39
39
  end
@@ -44,8 +44,8 @@ module Geocoder::Lookup
44
44
  "city" => "",
45
45
  "region_code" => "",
46
46
  "region_name" => "",
47
- "metrocode" => "",
48
- "zipcode" => "",
47
+ "metro_code" => "",
48
+ "zip_code" => "",
49
49
  "latitude" => "0",
50
50
  "longitude" => "0",
51
51
  "country_name" => "Reserved",
@@ -54,7 +54,7 @@ module Geocoder::Lookup
54
54
  end
55
55
 
56
56
  def host
57
- configuration[:host] || "freegeoip.net"
57
+ configuration[:host] || "freegeoip.app"
58
58
  end
59
59
  end
60
60
  end
@@ -9,13 +9,17 @@ module Geocoder::Lookup
9
9
  end
10
10
 
11
11
  def required_api_key_parts
12
- ["app_id", "app_code"]
12
+ ['api_key']
13
+ end
14
+
15
+ def supported_protocols
16
+ [:https]
13
17
  end
14
18
 
15
19
  private # ---------------------------------------------------------------
16
20
 
17
21
  def base_query_url(query)
18
- "#{protocol}://#{if query.reverse_geocode? then 'reverse.' end}geocoder.api.here.com/6.2/#{if query.reverse_geocode? then 'reverse' end}geocode.json?"
22
+ "#{protocol}://#{if query.reverse_geocode? then 'reverse.' end}geocoder.ls.hereapi.com/6.2/#{if query.reverse_geocode? then 'reverse' end}geocode.json?"
19
23
  end
20
24
 
21
25
  def results(query)
@@ -28,34 +32,36 @@ module Geocoder::Lookup
28
32
  []
29
33
  end
30
34
 
31
- def query_url_params(query)
35
+ def query_url_here_options(query, reverse_geocode)
32
36
  options = {
33
- :gen=>4,
34
- :app_id=>api_key,
35
- :app_code=>api_code
37
+ gen: 9,
38
+ apikey: configuration.api_key,
39
+ language: (query.language || configuration.language)
36
40
  }
41
+ if reverse_geocode
42
+ options[:mode] = :retrieveAddresses
43
+ return options
44
+ end
37
45
 
38
- if query.reverse_geocode?
39
- super.merge(options).merge(
40
- :prox=>query.sanitized_text,
41
- :mode=>:retrieveAddresses
42
- )
43
- else
44
- super.merge(options).merge(
45
- :searchtext=>query.sanitized_text
46
- )
46
+ unless (country = query.options[:country]).nil?
47
+ options[:country] = country
47
48
  end
48
- end
49
49
 
50
- def api_key
51
- if a=configuration.api_key
52
- return a.first if a.is_a?(Array)
50
+ unless (mapview = query.options[:bounds]).nil?
51
+ options[:mapview] = mapview.map{ |point| "%f,%f" % point }.join(';')
53
52
  end
53
+ options
54
54
  end
55
55
 
56
- def api_code
57
- if a=configuration.api_key
58
- return a.last if a.is_a?(Array)
56
+ def query_url_params(query)
57
+ if query.reverse_geocode?
58
+ super.merge(query_url_here_options(query, true)).merge(
59
+ prox: query.sanitized_text
60
+ )
61
+ else
62
+ super.merge(query_url_here_options(query, false)).merge(
63
+ searchtext: query.sanitized_text
64
+ )
59
65
  end
60
66
  end
61
67
  end