Skip to content

Instantly share code, notes, and snippets.

@vortec
Created February 7, 2017 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vortec/bdee285069ad49a76c5ecec7c8106a7b to your computer and use it in GitHub Desktop.
Save vortec/bdee285069ad49a76c5ecec7c8106a7b to your computer and use it in GitHub Desktop.
defmodule Action do
defmodule Configuration do
end
@callback description(Configuration) :: String
@callback perform(Configuration, String) :: nil
end
defmodule Webhook do
@behaviour Action
defmodule Configuration do
defstruct url: nil, method: "POST"
end
def description(%Configuration{url: url}) do
~s(Sends a text to '#{url}'.)
end
def perform(Configuration, text) do
text
end
end
config = %Webhook.Configuration{url: "http://httpbin.org"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment