Skip to content

Commit 804198d

Browse files
committed
Use latest liberator.mixin.
1 parent 07ae636 commit 804198d

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

project.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
:dependencies [[io.logicblocks/halboy "6.0.0"]
99
[io.logicblocks/hype "2.0.0"]
10-
[io.logicblocks/liberator.mixin "0.1.0-RC5"]]
10+
[io.logicblocks/liberator.mixin "0.1.0-RC14"]]
1111

1212
:plugins [[lein-cloverage "1.2.4"]
1313
[lein-shell "0.5.0"]

src/liberator/resource/ping/core.clj

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,33 @@
22
(:require
33
[halboy.resource :as hal]
44
[hype.core :as hype]
5-
[liberator.mixin.core :as mixin]
5+
[liberator.mixin.core :as lm-core]
6+
[liberator.mixin.util :as lm-util]
67
[liberator.mixin.json.core :as json-mixin]
78
[liberator.mixin.hypermedia.core :as hypermedia-mixin]
89
[liberator.mixin.hal.core :as hal-mixin]))
910

1011
(defn definitions
11-
([{:keys [router]}]
12+
([_]
1213
{:body (fn [_] {:message "pong"})
1314

15+
:self-link
16+
(fn [{:keys [request router]}]
17+
(hype/absolute-url-for request router :ping))
18+
1419
:handle-ok
15-
(fn [{:keys [request resource] :as context}]
16-
(let [body-fn (:body resource)
17-
body (body-fn context)]
20+
(fn [context]
21+
(let [body (lm-util/resource-attribute-as-value context :body)
22+
self-link (lm-util/resource-attribute-as-value context :self-link)]
1823
(hal/add-properties
19-
(hal/new-resource
20-
(hype/absolute-url-for request router :ping))
24+
(hal/new-resource self-link)
2125
body)))}))
2226

2327
(defn handler
2428
([dependencies]
2529
(handler dependencies {}))
2630
([dependencies overrides]
27-
(mixin/build-resource
31+
(lm-core/build-resource
2832
(json-mixin/with-json-mixin dependencies)
2933
(hypermedia-mixin/with-hypermedia-mixin dependencies)
3034
(hal-mixin/with-hal-mixin dependencies)

0 commit comments

Comments
 (0)