Skip to content

Instantly share code, notes, and snippets.

@denlab
Created October 6, 2012 22:16
Show Gist options
  • Save denlab/3846362 to your computer and use it in GitHub Desktop.
Save denlab/3846362 to your computer and use it in GitHub Desktop.
(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