Mandrillex
An HTTP client for Mandrill.
Summary
delete(url, headers \\ [], options \\ []) | |
get(url, headers \\ [], options \\ []) | |
head(url, headers \\ [], options \\ []) | |
key() | Grabs MANDRILL_KEY from system ENV Returns binary |
options(url, headers \\ [], options \\ []) | |
patch(url, body, headers \\ [], options \\ []) | |
post(url, body, headers \\ [], options \\ []) | |
process_headers(headers) | |
process_request_body(body) | |
process_request_headers(headers) | |
process_response_body(body) | Converts the binary keys in our response to atoms. Args:
|
process_response_chunk(chunk) | |
process_status_code(status_code) | |
process_url(url) | Creates the URL for our endpoint. Args:
|
put(url, body, headers \\ [], options \\ []) | |
request(endpoint, body) | Boilerplate code to make requests. Args:
|
request(method, url, body \\ "", headers \\ [], options \\ []) | Sends an HTTP request. Args:
|
start() | |
start(type, args) | Callback implementation of |
transformer(target) |
Functions
Converts the binary keys in our response to atoms. Args:
- body - string binary response Returns Record or ArgumentError
Creates the URL for our endpoint. Args:
- endpoint - part of the API we’re hitting Returns string
Boilerplate code to make requests. Args:
- endpoint - string requested API endpoint
- body - request body Returns dict
Sends an HTTP request. Args:
- method - HTTP method, atom (:get, :head, :post, :put, :delete, etc.)
- url - URL, binary string or char list
- body - request body, binary string or char list
- headers - HTTP headers, orddict (eg. [{:Accept, "application/json"}])
- options - orddict of options Options:
- timeout - timeout in ms, integer Returns HTTPoison.Response if successful. Raises HTTPoison.HTTPError if failed.
Callback implementation of :application.start/2
.