            test-jobs))
 
 (defn read-job-results
-    [job-name jenkins-url]
-    (let [url (str jenkins-url "job/" (.replaceAll job-name " " "%20") "/lastSuccessfulBuild/artifact/results.json/")]
+    [jenkins-url job-name]
+    (let [url (str (job-name->url jenkins-url job-name) "/lastSuccessfulBuild/artifact/results.json/")]
         (println "Using the following URL to retrieve job results: " url)
         (try
             (slurp url)

(require '[clojure.xml       :as xml])
(require '[clojure.zip       :as zip])

(require '[clojure.data.json :as json])
(require '[clj-http.client   :as http-client])

(defn read-list-of-all-jobs
    [jenkins-url job-list-part]
    (let [all-jobs-url (str jenkins-url job-list-part)]
        (println "Using the following URL to retrieve all Jenkins jobs: " all-jobs-url)
        (let [data (json/read-str (slurp all-jobs-url))]
            (if data
                (get data "jobs")
                nil))))

                 (.printStackTrace e)
                 nil))))

(defn start-job
    [jenkins-url job-name]
    (post-command jenkins-url job-name "build"))

(defn enable-job
    [jenkins-url job-name]
    (post-command jenkins-url job-name "enable"))

(defn disable-job
    [jenkins-url job-name]
    (post-command jenkins-url job-name "disable"))

