lib/onering/api.rb in onering-client-0.0.57 vs lib/onering/api.rb in onering-client-0.0.58
- old
+ new
@@ -55,10 +55,15 @@
_load_config(@_connection_options[:configfile], @_connection_options.get(:config, {}))
# set API connectivity details
Onering::API.base_uri @_config.get(:url, DEFAULT_BASE)
+ # add default parameters
+ options.get('config.params',{}).each do |k,v|
+ _default_param(k,v)
+ end
+
Onering::Reporter.setup()
connect(options) if options.get(:autoconnect, true)
end
def connect(options={})
@@ -188,10 +193,16 @@
else
_setup_auth_ssl()
end
end
+# -----------------------------------------------------------------------------
+ def _default_param(key, value)
+ @_default_params ||= {}
+ @_default_params[key] = value
+ Onering::API.default_params(@_default_params)
+ end
# -----------------------------------------------------------------------------
def _setup_auth_ssl()
begin
# get first keyfile found
@@ -277,11 +288,9 @@
Onering::API.headers({
'X-Auth-Mechanism' => 'token'
})
# set default parameters
- Onering::API.default_params({
- :token => key
- })
+ _default_param(:token, key)
end
end
end
\ No newline at end of file