Method: NexusAPI::API#initialize

Defined in:
lib/nexus_api.rb

#initialize(username:, password:, hostname:, docker_pull_hostname: nil, docker_push_hostname: nil, team_config: nil, protocol: "https") ⇒ API

Returns a new instance of API.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/nexus_api.rb', line 18

def initialize(username:, password:, hostname:, docker_pull_hostname: nil, docker_push_hostname: nil, team_config: nil, protocol: "https")
  @protocol = protocol
  @connection = NexusAPI::NexusConnection.new(
    username: username,
    password: password,
    hostname: hostname,
    protocol: protocol,
  )
  if docker_pull_hostname.nil? || docker_push_hostname.nil?
    @docker = nil
  else
    @docker = NexusAPI::DockerManager.new(
      docker: NexusAPI::DockerShell.new,
      options: {
        'username' => username,
        'password' => password,
        'pull_host' => docker_pull_hostname,
        'push_host' => docker_push_hostname,
      }
    )
  end
  team_config ||= TEAM_CONFIG
  @team_config = NexusAPI::ConfigManager.new(config_path: team_config)
end