Class: SoraGeocoding::Configuration
- Inherits:
-
Object
- Object
- SoraGeocoding::Configuration
- Includes:
- Singleton
- Defined in:
- lib/sora_geocoding/configuration.rb
Constant Summary collapse
- OPTIONS =
%i[ timeout http_headers use_https http_proxy https_proxy basic_auth site yahoo_appid logger_level always_raise ].freeze
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Class Method Summary collapse
Instance Method Summary collapse
- #configure(options) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #set_defaults ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
82 83 84 85 |
# File 'lib/sora_geocoding/configuration.rb', line 82 def initialize @data = SoraGeocoding::ConfigurationHash.new set_defaults end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
63 64 65 |
# File 'lib/sora_geocoding/configuration.rb', line 63 def data @data end |
Class Method Details
.set_defaults ⇒ Object
65 66 67 |
# File 'lib/sora_geocoding/configuration.rb', line 65 def self.set_defaults instance.set_defaults end |
Instance Method Details
#configure(options) ⇒ Object
78 79 80 |
# File 'lib/sora_geocoding/configuration.rb', line 78 def configure() @data.rmerge!() end |
#set_defaults ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/sora_geocoding/configuration.rb', line 87 def set_defaults # options @data[:timeout] = 3 # timeout (secs) @data[:http_headers] = {} # HTTP headers @data[:use_https] = false # use HTTPS for requests? @data[:http_proxy] = nil # HTTP proxy server (user:pass@host:port) @data[:https_proxy] = nil # HTTPS proxy server (user:pass@host:port) @data[:basic_auth] = {} # user and password for basic auth ({:user => "user", :password => "password"}) @data[:site] = nil @data[:yahoo_appid] = nil # API key for Yahoo Geocoder API @data[:logger_level] = ::Logger::WARN # log level, if kernel logger is used # [supports] # - :all # - SocketError # - Timeout::Error @data[:always_raise] = [] end |