   "Returns list of hashmaps representing the books on a given
   user's bookshelf"
   [consumer access-token user-id shelf & {:keys [query page per-page]}]
-  (let [shelf-url (str "https://www.goodreads.com/review/list/"
-                       user-id)
+  (let [shelf-url (build-url "review" "list" user-id)
         params (merge {:shelf shelf :format "xml" :v 2}
                       (when query
                         {(keyword "search[query]")

  "Runs a query for a book by title. Returns only the last
  20 results."
  [consumer access-token title]
  (let [search-url "https://www.goodreads.com/search/index"
        params {:q title
                :format "xml"
                :field "title"}

(ns myshelf.core
  (:require [clj-time.core :as t]
            [clojure.string :as str]
            [myshelf.auth :refer [make-auth-request-GET
                                  make-auth-request-POST
                                  make-auth-request-PUT]]))

(def goodreads-base-url "https://www.goodreads.com")
(def goodreads-crypto-default :hmac-sha1)

(defn build-url
  [& parts]
  (str/join "/" (apply conj [goodreads-base-url] parts)))

(defn get-user-id
  "Fetch the Goodreads user id for the user that has granted access"
  [consumer access-token]
  (let [user-id-url (build-url "api" "auth_user")
        resp (make-auth-request-GET consumer
                                    access-token
                                    user-id-url
