Method: Code42::Client#connection

Defined in:
lib/code42/client.rb

#connectionObject



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/code42/client.rb', line 60

def connection
  @connection ||= begin
                    connection = Connection.new
                    settings.debug && connection.use(Faraday::Response::Logger)
                    connection
                  end
  @connection.host         = settings.host
  @connection.port         = settings.port
  @connection.scheme       = settings.scheme
  @connection.path_prefix  = settings.api_root
  @connection.verify_https = settings.verify_https
  if settings.username && settings.password
    @connection.username = settings.username
    @connection.password = settings.password
  end
  if settings.token
    @connection.token = settings.token
  end
  if settings.mlk
    @connection.mlk = settings.mlk
  end
  @connection
end