Created
January 26, 2016 18:38
-
-
Save mndvns/af82070dab4497064b24 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
defmodule Api.Resource.Cases.Read do | |
defmacro __using__([type: typename]) do | |
quote do | |
import unquote(__MODULE__) | |
use PoeApi.Resource | |
param item | |
let item_res = Case.get(unquote(typename), item) | |
hyper do | |
action do | |
%{ | |
# "update" => link_to(Api.Resource.Cases.Update, type: type, item: item["sys_id"]), | |
# "remove" => link_to(Api.Resource.Cases.Remove, type: type, item: item["sys_id"]) | |
} |> ^Map.merge(item_res) | |
end | |
end | |
end | |
end | |
end | |
defmodule Api.Resource.Changes.Read do | |
use Api.Resource.Cases.Read, type: "changes" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment