Skip to content

Instantly share code, notes, and snippets.

@knewter
Created August 1, 2014 03:03
Show Gist options
  • Save knewter/f2fa46dc543ae20fd662 to your computer and use it in GitHub Desktop.
Save knewter/f2fa46dc543ae20fd662 to your computer and use it in GitHub Desktop.
defmodule HexClient do
use HTTPoison.Base
@base_url "https://hex.pm/api/"
def packages, do: packages_path |> get_body
defp get_body(path), do: get(path).body
defp packages_path, do: "packages"
def process_url(url), do: @base_url <> url
def process_response_body(body), do: JSEX.decode!(body)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment