Skip to content

Instantly share code, notes, and snippets.

@desmondmonster
Last active March 14, 2018 23:22
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 desmondmonster/4cd2429047838b635b92a293ed70062d to your computer and use it in GitHub Desktop.
Save desmondmonster/4cd2429047838b635b92a293ed70062d to your computer and use it in GitHub Desktop.
CRM Interface Module
defmodule YourApp.CRM do
def create_user(user) do
crm_data =
user
|> fetch_crm_data()
|> parse()
user
|> YourApp.User.crm_changeset(crm_data)
|> YourApp.Repo.update!()
end
defp fetch_crm_data(user) do
# your code here
end
defp parse(data) do
# you will probably want to parse results for use in a changeset
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment