Method: Nps::SoapClient#initialize

Defined in:
lib/nps/soap_client.rb

#initialize(conf) ⇒ SoapClient

Returns a new instance of SoapClient.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/nps/soap_client.rb', line 6

def initialize(conf)
  if conf.logger.nil?
    conf.logger = Logger.new(STDOUT)
  end

  if conf.log_level != Logger::DEBUG
    conf.logger.formatter = NpsFormatter.new
  end
  if conf.log_level == Logger::DEBUG and conf.environment == Nps::Environments::PRODUCTION_ENV
    raise LoggerException
  end  

  @key = conf.key
  @log = true
  @logger = conf.logger
  @wsdl = conf.environment
  @open_timeout = conf.o_timeout.nil? ? 5 : conf.o_timeout
  @read_timeout = conf.r_timeout.nil? ? 60 : conf.r_timeout
  @verify_ssl = conf.verify_ssl.nil? ? true : conf.verify_ssl
  @sanitize = conf.sanitize.nil? ? true : conf.sanitize
  @log_level = conf.log_level ? conf.log_level : nil
  @proxy = conf.proxy_url ? conf.proxy_url : nil
  @proxy_username = conf.proxy_username ? @proxy_username : nil
  @proxy_password = conf.proxy_password ? @proxy_password : nil

  setup
end