-
-
Save ngw/fd037084af03f75cdf7540117551a8f1 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 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