Skip to content
Snippets Groups Projects
Commit 7b044bc8 authored by Tamas Erdos's avatar Tamas Erdos
Browse files

no longer using global config hash

parent a40d28b5
No related branches found
No related tags found
No related merge requests found
......@@ -57,8 +57,6 @@ module Geocoder
:units,
:distances,
:basic_auth,
:for_storage,
:token,
:logger,
:kernel_logger_level
]
......@@ -102,8 +100,6 @@ module Geocoder
@data[:cache] = nil # cache object (must respond to #[], #[]=, and #keys)
@data[:cache_prefix] = "geocoder:" # prefix (string) to use for all cache keys
@data[:basic_auth] = {} # user and password for basic auth ({:user => "user", :password => "password"})
@data[:for_storage] = nil # will the result be stored for non-caching purposes (boolean)
@data[:token] = nil # token object for authentication
@data[:logger] = :kernel # :kernel or Logger instance
@data[:kernel_logger_level] = ::Logger::WARN # log level, if kernel logger is used
......
......@@ -43,13 +43,13 @@ module Geocoder::Lookup
params[:text] = query.sanitized_text
end
params[:token] = token
params[:forStorage] = configuration.for_storage if configuration.for_storage
params[:forStorage] = configuration[:for_storage] if configuration[:for_storage]
params.merge(super)
end
def token
if configuration.token && configuration.token.active? # if we have a token, use it
configuration.token.to_s
if configuration[:token] && configuration[:token].active? # if we have a token, use it
configuration[:token].to_s
elsif configuration.api_key # generate a new token if we have credentials
token_instance = EsriToken.generate_token(*configuration.api_key)
Geocoder.configure(:esri => {:token => token_instance})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment