refactor
This commit is contained in:
parent
002c7d3054
commit
c8fdf4bbd2
|
@ -1,9 +1,7 @@
|
|||
(ns clj-hl7-fhir.core
|
||||
(:import (java.util Date)
|
||||
(clojure.lang ExceptionInfo))
|
||||
(:require [clojure.string :as str]
|
||||
[clj-http.client :as http]
|
||||
[cheshire.core :as json])
|
||||
(:require [clojure.string :as str])
|
||||
(:use [camel-snake-kebab]
|
||||
[clj-hl7-fhir.util]))
|
||||
|
||||
|
@ -14,10 +12,7 @@
|
|||
(let [query (cond
|
||||
(sequential? params) (->> params (concat [:_format "json"]) (kv-vector->query))
|
||||
:else (merge {:_format "json"} params))]
|
||||
(-> (build-url base-url resource-url query)
|
||||
(http/get)
|
||||
:body
|
||||
(json/parse-string true))))
|
||||
(http-get-json (build-url base-url resource-url query))))
|
||||
|
||||
(defn- ->search-param-name [parameter & [modifier]]
|
||||
(keyword
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
(:import (java.util TimeZone Date)
|
||||
(java.text SimpleDateFormat))
|
||||
(:require [clojure.string :as str]
|
||||
[cemerick.url :refer [url url-encode]]))
|
||||
[clj-http.client :as http]
|
||||
[cemerick.url :refer [url url-encode]]
|
||||
[cheshire.core :as json]))
|
||||
|
||||
(def tz (TimeZone/getDefault))
|
||||
(def iso8601 "yyyy-MM-dd'T'HH:mm:ssZZ")
|
||||
|
@ -41,3 +43,8 @@
|
|||
(join-paths existing-path path)))
|
||||
(assoc :query params)
|
||||
(str)))
|
||||
|
||||
(defn http-get-json [url]
|
||||
(-> (http/get url)
|
||||
:body
|
||||
(json/parse-string true)))
|
Reference in a new issue