Skip to content

Commit

Permalink
Removing geocoder.us. Changing api_key to key for IP-API, similar to …
Browse files Browse the repository at this point in the history
…other geocoders.
  • Loading branch information
ryankopf committed Feb 2, 2023
1 parent 8c921fd commit f91a537
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 108 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.15.0

* Removed support for no longer accessible geocoder.us

## 1.14.0

* Introduced NoSuchGeocoderError. If you try call a geocoder like :bogus that doesn't exist, an error will be returned.
Expand Down
13 changes: 2 additions & 11 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ Combine this gem with the [geokit-rails](http://github.com/geokit/geokit-rails)
### IP address geocoders
* IP - geocodes an IP address using hostip.info's web service.
* Geoplugin.net -- another IP address geocoder
* Geobytes
* RIPE
* MaxMind
* Ipstack
Expand Down Expand Up @@ -150,13 +149,6 @@ If you're using this gem by itself, here are the configuration options:
# You define these keys with a Hash as follows:
#Geokit::Geocoders::google = { 'rubyonrails.org' => 'RUBY_ON_RAILS_API_KEY', 'ruby-docs.org' => 'RUBY_DOCS_API_KEY' }

# This is your username and password for geocoder.us.
# To use the free service, the value can be set to nil or false. For
# usage tied to an account, the value should be set to username:password.
# See http://geocoder.us
# and http://geocoder.us/user/signup
Geokit::Geocoders::UsGeocoder.key = 'username:password'

# This is your authorization key for geocoder.ca.
# To use the free service, the value can be set to nil or false. For
# usage tied to an account, set the value to the key obtained from
Expand All @@ -177,9 +169,8 @@ If you're using this gem by itself, here are the configuration options:

# This is your api key for ip-api.com.
# For the free version (with rate limits), leave api_key unset.
# For the pro version, api_key must be set
# See https://ip-api.com/
Geokit::Geocoders::IpApiGeocoder.api_key = 'API_KEY'
Geokit::Geocoders::IpApiGeocoder.key = ''

# Most other geocoders need either no setup or a key
Geokit::Geocoders::BingGeocoder.key = ''
Expand Down Expand Up @@ -210,7 +201,7 @@ If you're using this gem by itself, here are the configuration options:

# The IP provider order.
#
# Valid symbols are :ipstack, :geo_plugin, :geobytes, :ip, and :ripe.
# Valid symbols are :ipstack, :geo_plugin, :ip, and :ripe.
#
# As before, make sure you read up on relevant Terms of Use for each.
# Geokit::Geocoders::ip_provider_order = [:external,:geo_plugin,:ip]
Expand Down
6 changes: 3 additions & 3 deletions lib/geokit/geocoders/ip_api_geocoder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Geokit
module Geocoders
# Provides geocoding based upon an IP address. The underlying web service is ip-api.com
class IpApiGeocoder < BaseIpGeocoder
config :api_key
config :key

private

Expand All @@ -11,10 +11,10 @@ def self.do_geocode(ip, _=nil)
end

def self.submit_url(ip)
if api_key.nil?
if key.nil?
"http://ip-api.com/json/#{ip}"
else
"http://pro.ip-api.com/json/#{ip}?key=#{api_key}"
"http://pro.ip-api.com/json/#{ip}?key=#{key}"
end
end

Expand Down
37 changes: 0 additions & 37 deletions lib/geokit/geocoders/us_geocoder.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/geokit/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Geokit
VERSION = '1.14.0'
VERSION = '1.15.0'
end
2 changes: 1 addition & 1 deletion test/test_ip_api_geocoder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_ip_api_geocode
end

def test_ip_api_pro_geocode
geocoder_class.api_key = 'some_api_key'
geocoder_class.key = 'some_api_key'
url = "http://pro.ip-api.com/json/#{@ip}?key=some_api_key"
res = geocode(@ip, :ip_api_pro_geocode)
assert_url url
Expand Down
55 changes: 0 additions & 55 deletions test/test_us_geocoder.rb

This file was deleted.

0 comments on commit f91a537

Please sign in to comment.