Class: LeeroyJenkins::JenkinsClientBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/leeroy_jenkins/jenkins_client_builder.rb

Overview

TODO: this isn’t what a builder is

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ JenkinsClientBuilder

Returns a new instance of JenkinsClientBuilder.



6
7
8
9
10
11
12
13
# File 'lib/leeroy_jenkins/jenkins_client_builder.rb', line 6

def initialize(options = {})
  @server_url = options[:server_url] || ENV['LEEROY_JENKINS_SERVER_URL']
  @username = options[:username] || ENV['LEEROY_JENKINS_USERNAME']
  @password = options[:password] || ENV['LEEROY_JENKINS_PASSWORD']

  @log_level = options[:log_level] || 1
  @log_location = options[:log_location] || STDOUT
end

Instance Attribute Details

#log_levelObject (readonly)

Returns the value of attribute log_level.



4
5
6
# File 'lib/leeroy_jenkins/jenkins_client_builder.rb', line 4

def log_level
  @log_level
end

#log_locationObject (readonly)

Returns the value of attribute log_location.



4
5
6
# File 'lib/leeroy_jenkins/jenkins_client_builder.rb', line 4

def log_location
  @log_location
end

#passwordObject (readonly)

Returns the value of attribute password.



4
5
6
# File 'lib/leeroy_jenkins/jenkins_client_builder.rb', line 4

def password
  @password
end

#server_urlObject (readonly)

Returns the value of attribute server_url.



4
5
6
# File 'lib/leeroy_jenkins/jenkins_client_builder.rb', line 4

def server_url
  @server_url
end

#usernameObject (readonly)

Returns the value of attribute username.



4
5
6
# File 'lib/leeroy_jenkins/jenkins_client_builder.rb', line 4

def username
  @username
end

Instance Method Details

#buildObject



15
16
17
18
19
20
21
# File 'lib/leeroy_jenkins/jenkins_client_builder.rb', line 15

def build
  JenkinsApi::Client.new server_url: server_url,
                         username: username,
                         password: password,
                         log_level: log_level,
                         log_location: log_location
end