Created
February 7, 2017 21:52
-
-
Save vortec/bdee285069ad49a76c5ecec7c8106a7b to your computer and use it in GitHub Desktop.
This file contains 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 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