Sha256: 34372eb4f4f958353993d9b4dfb21e98286a8475ff0b0afe71319acbf446d306
Contents?: true
Size: 788 Bytes
Versions: 3
Compression:
Stored size: 788 Bytes
Contents
require 'net/http' require 'json' module Korinthenkacker class API def initialize(base_url) uri = URI(base_url) @host = uri.host @port = uri.port end def jobs get('') end def job(jobname) get("/job/#{jobname}") end def build(jobname, build) get("/job/#{jobname}/#{build}") end def test_report(jobname, build) get("/job/#{jobname}/#{build}/testReport") end private def get(path) uri = URI::HTTP.build({:host => @host, :port => @port, :path => path + '/api/json'}) response = Net::HTTP.get_response(uri) if response.code == '200' JSON.parse(response.body) else raise 'response code is ' + response.code + ' for ' + uri.to_s end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
korinthenkacker-0.0.3 | lib/korinthenkacker/api.rb |
korinthenkacker-0.0.2 | lib/korinthenkacker/api.rb |
korinthenkacker-0.0.1 | lib/korinthenkacker/api.rb |