Class: Nominatim::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/nominatim/configuration.rb

Constant Summary collapse

DEFAULT_ENDPOINT =
'http://nominatim.openstreetmap.org'
DEFAULT_USER_AGENT =
"Nominatim Ruby Gem #{Nominatim::VERSION}"
DEFAULT_EMAIL =
nil
DEFAULT_LANGUAGE =
'en'
DEFAULT_TIMEOUT =
nil
DEFAULT_SEARCH_URL =
'search'
DEFAULT_REVERSE_URL =
'reverse'
VALID_OPTIONS_KEYS =
[
  :endpoint,
  :user_agent,
  :email,
  :accept_language,
  :timeout,
  :search_url,
  :reverse_url,
  :proxy
]

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



30
31
32
# File 'lib/nominatim/configuration.rb', line 30

def initialize
  reset!
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



34
35
36
37
# File 'lib/nominatim/configuration.rb', line 34

def configure
  yield self
  self
end

#reset!Object



39
40
41
42
43
44
45
46
47
# File 'lib/nominatim/configuration.rb', line 39

def reset!
  self.endpoint         = DEFAULT_ENDPOINT
  self.user_agent       = DEFAULT_USER_AGENT
  self.email            = DEFAULT_EMAIL
  self.accept_language  = DEFAULT_LANGUAGE
  self.timeout          = DEFAULT_TIMEOUT
  self.search_url       = DEFAULT_SEARCH_URL
  self.reverse_url      = DEFAULT_REVERSE_URL
end