class DTK::Client::JenkinsClient::Connection
Public Class Methods
new(connection_hash)
click to toggle source
Calls superclass method
# File lib/command_helpers/jenkins_client.rb, line 71 def initialize(connection_hash) super() merge!(connection_hash) set_connection() end
Public Instance Methods
create_job(job_name,config_xml_contents)
click to toggle source
# File lib/command_helpers/jenkins_client.rb, line 76 def create_job(job_name,config_xml_contents) ::Jenkins::Client::Job.create(job_name, config_xml_contents) end
get_info()
click to toggle source
# File lib/command_helpers/jenkins_client.rb, line 80 def get_info() get('api/json') end
get_jobs()
click to toggle source
# File lib/command_helpers/jenkins_client.rb, line 84 def get_jobs() get_info()["jobs"] end
Private Instance Methods
get(path)
click to toggle source
# File lib/command_helpers/jenkins_client.rb, line 97 def get(path) faraday_response = ::Jenkins::Client.get(path) unless [200].include?(faraday_response.status) raise Error.new("Bad response from Jenkins (status = #{faraday_response.status.to_s})") end faraday_response.body end
set_connection()
click to toggle source
TODO: one issue with the jenkins-client adapter is that it a singleton and thus only allows connection under one user to one jenkins server
# File lib/command_helpers/jenkins_client.rb, line 89 def set_connection() ::Jenkins::Client.configure do |c| c.username = self[:username] c.password = self[:password] c.url = self[:url] end end