Skip to content

Instantly share code, notes, and snippets.

@ngw
Created September 9, 2016 15:29
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 ngw/fd037084af03f75cdf7540117551a8f1 to your computer and use it in GitHub Desktop.
Save ngw/fd037084af03f75cdf7540117551a8f1 to your computer and use it in GitHub Desktop.
defmodule Owl.MacawService do
@derive [Poison.Encoder]
defstruct [:id,
:name,
:code,
:notification_endpoint,
:legacy_notifications,
:created_at,
:updated_at]
def fetch(code) do
with {:ok, response} <-
MGageClient.get("#{Application.get_env(:owl, :macaw)[:url]}/admin/services/#{code}",
["Content-type": "application/json"],
[access_id: Application.get_env(:owl, :macaw)[:access_id],
secret: Application.get_env(:owl, :macaw)[:secret]]),
do: {:ok, Poison.decode!(response.body, as: %Owl.MacawService{})}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment