Created
October 6, 2012 22:16
-
-
Save denlab/3846362 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 foo.bar | |
(:use [midje.sweet] | |
[clojure | |
[pprint :only [pprint pp]] | |
[repl :only [doc find-doc apropos]]] | |
[clojure.java.javadoc :only [javadoc]] | |
[clojure.tools.trace :only [trace deftrace trace-forms trace-ns untrace-ns trace-vars]]) | |
(:require [clojure | |
[set :as set] | |
[string :as str] | |
[xml :as xml]] | |
[clojure.java | |
[shell :as sh] | |
[io :as io]])) | |
(defn create-attr-map | |
[attr-code attr-type src-code] | |
{"attribute" | |
{"name" attr-code | |
"attributeType" {"href" (format "/foundation/v2/attributeTypes/%s" attr-type)} | |
"source" {"href" (format "/foundation/v2/%s" src-code)}}}) | |
(defn put-attr | |
"Put an attribute into wikeo" | |
[attr-code attr-type src-code] | |
(wikeo-query :put | |
(format "/foundation/v2/attributes/%s" attr-code) | |
{:body (json-encode (create-attr-map attr-code attr-type src-code)) | |
:content-type :json})) | |
(defn put-attr | |
"Put an attribute into wikeo" | |
[attr-code attr-type src-code] | |
(wikeo-query :put (format "/foundation/v2/attributes/%s" attr-code) | |
{:body {"attribute" | |
{"name" attr-code | |
"attributeType" {"href" (format "/foundation/v2/attributeTypes/%s" attr-type)} | |
"source" {"href" (format "/foundation/v2/%s" src-code)}}}))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment