Class: Geocoder::Lookup::Freegeoip

Inherits:
Base
  • Object
show all
Defined in:
lib/geocoder/lookups/freegeoip.rb

Instance Method Summary collapse

Methods inherited from Base

#cache, #handle, #initialize, #map_link_url, #required_api_key_parts, #search

Constructor Details

This class inherits a constructor from Geocoder::Lookup::Base

Instance Method Details

#nameObject


7
8
9
# File 'lib/geocoder/lookups/freegeoip.rb', line 7

def name
  "FreeGeoIP"
end

#query_url(query) ⇒ Object


20
21
22
# File 'lib/geocoder/lookups/freegeoip.rb', line 20

def query_url(query)
  "#{protocol}://#{host}/json/#{query.sanitized_text}"
end

#supported_protocolsObject


11
12
13
14
15
16
17
18
# File 'lib/geocoder/lookups/freegeoip.rb', line 11

def supported_protocols
  if configuration[:host]
    [:https]
  else
    # use https for default host
    [:https]
  end
end