Created
June 14, 2011 18:17
-
-
Save bamboo/1025495 to your computer and use it in GitHub Desktop.
interacting with fogbugz using clojure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns fogbugz | |
(:use [clojure.xml :as xml])) | |
(def *base-url* "https://intra.unity3d.com/fogbugz/api.asp?") | |
(defn query-string-from-map [m] | |
(apply str (interpose "&" (for [[key value] m] (str (name key) "=" value))))) | |
(defn rest-call [args] | |
(let [query-string (query-string-from-map args)] | |
(xml/parse (str *base-url* query-string)))) | |
(defn rest-call-with-response [args] | |
(let [response (rest-call args)] | |
(-> response :content first :content))) | |
(defn logon [email password] | |
(let [response (rest-call-with-response {:cmd "logon" :email email :password password}) | |
token (first response)] | |
token)) | |
(defn release-notes-for [token version] | |
(let [response (rest-call-with-response {:token token :cmd "search" :q (str "fixfor:" version " and status:closed") :cols "sReleaseNotes"}) | |
bugs (map :content response)] | |
bugs)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment