class Geocoder::Lookup::Base

Public Class Methods

new() click to toggle source
# File lib/geocoder/lookups/base.rb, line 17
def initialize
  @cache = nil
end

Public Instance Methods

cache() click to toggle source

The working Cache object.

# File lib/geocoder/lookups/base.rb, line 85
def cache
  if @cache.nil? and store = configuration.cache
    @cache = Cache.new(store, configuration.cache_prefix)
  end
  @cache
end
handle() click to toggle source

Symbol which is used in configuration to refer to this Lookup.

# File lib/geocoder/lookups/base.rb, line 31
def handle
  str = self.class.to_s
  str[str.rindex(':')+1..-1].gsub(/([a-z\d]+)([A-Z])/,'\1_\2').downcase.to_sym
end
name() click to toggle source

Human-readable name of the geocoding API.

# File lib/geocoder/lookups/base.rb, line 24
def name
  fail
end
query_url(query) click to toggle source

URL to use for querying the geocoding engine.

Subclasses should not modify this method. Instead they should define base_query_url and url_query_string. If absolutely necessary to subclss this method, they must also subclass cache_key.

# File lib/geocoder/lookups/base.rb, line 78
def query_url(query)
  base_query_url(query) + url_query_string(query)
end
required_api_key_parts() click to toggle source

Array containing string descriptions of keys required by the API. Empty array if keys are optional or not required.

# File lib/geocoder/lookups/base.rb, line 67
def required_api_key_parts
  []
end
supported_protocols() click to toggle source

Array containing the protocols supported by the api. Should be set to [:http] if only HTTP is supported or [:https] if only HTTPS is supported.

# File lib/geocoder/lookups/base.rb, line 97
def supported_protocols
  [:http, :https]
end