class Geocoder::Configuration
def self.initialize
def self.initialize instance.send(:initialize) end
def self.set_defaults
def self.set_defaults instance.set_defaults end
def configure(options)
def configure(options) Util.recursive_hash_merge(@data, options) end
def initialize # :nodoc
def initialize # :nodoc @data = Geocoder::ConfigurationHash.new set_defaults end
def set_defaults
def set_defaults # geocoding options @data[:timeout] = 3 # geocoding service timeout (secs) @data[:lookup] = :nominatim # name of street address geocoding service (symbol) @data[:ip_lookup] = :ipinfo_io # name of IP address geocoding service (symbol) @data[:language] = :en # ISO-639 language code @data[:http_headers] = {} # HTTP headers for lookup @data[:use_https] = false # use HTTPS for lookup requests? (if supported) @data[:http_proxy] = nil # HTTP proxy server (user:pass@host:port) @data[:https_proxy] = nil # HTTPS proxy server (user:pass@host:port) @data[:api_key] = nil # API key for geocoding service @data[:basic_auth] = {} # user and password for basic auth ({:user => "user", :password => "password"}) @data[:logger] = :kernel # :kernel or Logger instance @data[:kernel_logger_level] = ::Logger::WARN # log level, if kernel logger is used # exceptions that should not be rescued by default # (if you want to implement custom error handling); # supports SocketError and Timeout::Error @data[:always_raise] = [] # calculation options @data[:units] = :mi # :mi or :km @data[:distances] = :linear # :linear or :spherical # Set the default values for the caching mechanism # By default, the cache keys will not expire as IP addresses and phyiscal # addresses will rarely change. @data[:cache] = nil # cache object (must respond to #[], #[]=, and optionally #keys) @data[:cache_prefix] = nil # - DEPRECATED - prefix (string) to use for all cache keys @data[:cache_options] = { prefix: 'geocoder:', expiration: nil } end