Class: UltraVault::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/ultravault/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Config

Returns a new instance of Config.



21
22
23
24
# File 'lib/ultravault/config.rb', line 21

def initialize(params={})
  params = defaults.merge(params)
  update(params)
end

Instance Attribute Details

#api_versionObject

Returns the value of attribute api_version.



17
18
19
# File 'lib/ultravault/config.rb', line 17

def api_version
  @api_version
end

#debugObject

Returns the value of attribute debug.



17
18
19
# File 'lib/ultravault/config.rb', line 17

def debug
  @debug
end

#hostObject

Returns the value of attribute host.



17
18
19
# File 'lib/ultravault/config.rb', line 17

def host
  @host
end

#passwordObject

Returns the value of attribute password.



17
18
19
# File 'lib/ultravault/config.rb', line 17

def password
  @password
end

#portObject

Returns the value of attribute port.



17
18
19
# File 'lib/ultravault/config.rb', line 17

def port
  @port
end

#sslObject

Returns the value of attribute ssl.



17
18
19
# File 'lib/ultravault/config.rb', line 17

def ssl
  @ssl
end

#usernameObject

Returns the value of attribute username.



17
18
19
# File 'lib/ultravault/config.rb', line 17

def username
  @username
end

Instance Method Details

#set_debug(state) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/ultravault/config.rb', line 37

def set_debug(state)
  Savon.configure do |config| 
    config.log = state
    HTTPI.log = state
  end
  @debug = state
end

#update(params) ⇒ Object



26
27
28
29
30
31
# File 'lib/ultravault/config.rb', line 26

def update(params)
  params.each do |k,v|
    instance_variable_set("@#{k}", v)
  end
  set_debug(@debug)
end