diff options
author | Mentor Ágil <mentoragil@gmail.com> | 2015-05-12 23:52:51 -0300 |
---|---|---|
committer | Mentor Ágil <mentoragil@gmail.com> | 2015-05-12 23:52:51 -0300 |
commit | 68d6b62493e118667588a04260dac67a3ae4ad0b (patch) | |
tree | 2f2179456151cc60c6481b363c22186b7ff96d3b /lib/httpclient.ex | |
parent | 765438c4c2c300f84364b978a0b199a0e69c4e80 (diff) | |
download | mailchimp-68d6b62493e118667588a04260dac67a3ae4ad0b.tar.gz mailchimp-68d6b62493e118667588a04260dac67a3ae4ad0b.tar.xz |
added functions to manipulate lists
Diffstat (limited to 'lib/httpclient.ex')
-rw-r--r-- | lib/httpclient.ex | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/httpclient.ex b/lib/httpclient.ex index b5d0f1e..2b1594b 100644 --- a/lib/httpclient.ex +++ b/lib/httpclient.ex @@ -11,6 +11,17 @@ defmodule Mailchimp.HTTPClient do end end + def post(url, body, header) do + case HTTPoison.post(url, body, header) do + {:ok, %HTTPoison.Response{status_code: 200, body: body}} -> + process_response_body body + {:ok, %HTTPoison.Response{status_code: 404}} -> + "Not found :(" + {:error, %HTTPoison.Error{reason: reason}} -> + reason + end + end + def process_response_body(body) do body |> Poison.decode! |