Created
May 20, 2016 11:41
-
-
Save willrax/cfcf1236ae96c794611de03c2e3661b9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Site.CircleCi do | |
use Status.Site | |
def handle_response(response) do | |
Poison.Parser.parse!(response.body) | |
|> determine_app_state | |
end | |
defp url(site) do | |
"https://circleci.com/api/v1/project/#{site.app}/tree/master?limit=1&circle-token=#{System.get_env("CIRCLECI_TOKEN")}" | |
end | |
def determine_app_state([%{"status" => "running"} | _]), do: :pending | |
def determine_app_state([%{"status" => "queued"} | _]), do: :pending | |
def determine_app_state([%{"status" => "not_running"} | _]), do: :pending | |
def determine_app_state([%{"status" => "success"} | _]), do: :ok | |
def determine_app_state([%{"status" => "fixed"} | _]), do: :ok | |
def determine_app_state([%{"status" => "not_run"} | _]), do: :ok | |
def determine_app_state(_), do: :notok | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment