Last active
May 24, 2020 10:52
-
-
Save KamilLelonek/99a80299048075f93a100830e083518f 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 Pipelinex.Rating do | |
@enforce_keys ~w(author comment)a | |
defstruct @enforce_keys | |
def new(params), do: struct!(__MODULE__, params) | |
def encode(%__MODULE__{author: author, comment: comment}) do | |
%{ | |
"author" => author, | |
"comment" => comment | |
} | |
end | |
end |
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 Pipelinex.Video do | |
@enforce_keys ~w(title ratings)a | |
defstruct @enforce_keys | |
def new(params), do: struct!(__MODULE__, params) | |
def encode(%__MODULE__{title: title, ratings: ratings}), | |
do: %{"title" => title, "ratings" => ratings} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment