From 1114fb303c8c5cff172f6517dded10b51da81738 Mon Sep 17 00:00:00 2001 From: Nick Kezhaya Date: Tue, 19 Nov 2019 16:15:53 -0700 Subject: [PATCH 01/12] mix format --- lib/mandrill.ex | 4 +- lib/mandrill/exports.ex | 32 +++++---- lib/mandrill/inbound.ex | 78 ++++++++++++--------- lib/mandrill/ips.ex | 134 +++++++++++++++++++++--------------- lib/mandrill/messages.ex | 133 +++++++++++++++++++++-------------- lib/mandrill/rejects.ex | 30 ++++---- lib/mandrill/senders.ex | 54 +++++++++------ lib/mandrill/subaccounts.ex | 64 ++++++++++------- lib/mandrill/supervisor.ex | 2 +- lib/mandrill/tags.ex | 30 ++++---- lib/mandrill/templates.ex | 74 ++++++++++++-------- lib/mandrill/urls.ex | 38 ++++++---- lib/mandrill/users.ex | 14 ++-- lib/mandrill/webhooks.ex | 36 ++++++---- lib/mandrill/whitelists.ex | 32 +++++---- mix.exs | 27 ++++---- test/mandrill_test.exs | 9 ++- test/test_helper.exs | 2 +- 18 files changed, 475 insertions(+), 318 deletions(-) diff --git a/lib/mandrill.ex b/lib/mandrill.ex index 9897fb8..3942da1 100644 --- a/lib/mandrill.ex +++ b/lib/mandrill.ex @@ -8,7 +8,7 @@ defmodule Mandrill do use HTTPoison.Base def start(_type, _args) do - Mandrill.Supervisor.start_link + Mandrill.Supervisor.start_link() end @doc """ @@ -39,7 +39,7 @@ defmodule Mandrill do Returns dict """ def request(endpoint, body) do - Mandrill.post!(endpoint, JSX.encode! body).body + Mandrill.post!(endpoint, JSX.encode!(body)).body end @doc """ diff --git a/lib/mandrill/exports.ex b/lib/mandrill/exports.ex index dbeaadf..02613a6 100644 --- a/lib/mandrill/exports.ex +++ b/lib/mandrill/exports.ex @@ -15,13 +15,15 @@ defmodule Mandrill.Exports do format for that job type. """ def info(params) when is_list(params) do - Mandrill.request("exports/info", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("exports/info", Enum.concat([key: Mandrill.key()], params)) end + def info(id) do params = [ - key: Mandrill.key, + key: Mandrill.key(), id: id ] + Mandrill.request("exports/info", params) end @@ -29,7 +31,7 @@ defmodule Mandrill.Exports do Returns a list of your exports. """ def list do - params = [ key: Mandrill.key ] + params = [key: Mandrill.key()] Mandrill.request("exports/list", params) end @@ -43,13 +45,15 @@ defmodule Mandrill.Exports do expires_at. """ def rejects(params) when is_list(params) do - Mandrill.request("exports/rejects", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("exports/rejects", Enum.concat([key: Mandrill.key()], params)) end + def rejects(notify_email) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), notify_email: notify_email ] + Mandrill.request("exports/rejects", params) end @@ -62,13 +66,15 @@ defmodule Mandrill.Exports do created_at. """ def whitelist(params) when is_list(params) do - Mandrill.request("exports/whitelist", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("exports/whitelist", Enum.concat([key: Mandrill.key()], params)) end + def whitelist(notify_email) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), notify_email: notify_email ] + Mandrill.request("exports/whitelist", params) end @@ -86,11 +92,12 @@ defmodule Mandrill.Exports do included in the exported data. """ def activity(params) when is_list(params) do - Mandrill.request("exports/activity", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("exports/activity", Enum.concat([key: Mandrill.key()], params)) end + def activity(notify_email, date_from, date_to, tags, senders, states, api_keys) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), notify_email: notify_email, date_from: date_from, date_to: date_to, @@ -99,6 +106,7 @@ defmodule Mandrill.Exports do states: states, api_keys: api_keys ] + Mandrill.request("exports/activity", params) end end diff --git a/lib/mandrill/inbound.ex b/lib/mandrill/inbound.ex index 40d8e4f..e541285 100644 --- a/lib/mandrill/inbound.ex +++ b/lib/mandrill/inbound.ex @@ -8,7 +8,7 @@ defmodule Mandrill.Inbound do for inbound delivery """ def domains do - params = [ key: Mandrill.key ] + params = [key: Mandrill.key()] Mandrill.request("inbound/domains", params) end @@ -16,13 +16,15 @@ defmodule Mandrill.Inbound do Add an inbound domain to your account """ def add_domain(params) when is_list(params) do - Mandrill.request("inbound/add_domain", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("inbound/add_domain", Enum.concat([key: Mandrill.key()], params)) end + def add_domain(domain) do - params = [ - key: Mandrill.key, - domain: domain + params = [ + key: Mandrill.key(), + domain: domain ] + Mandrill.request("inbound/add-domain", params) end @@ -32,13 +34,15 @@ defmodule Mandrill.Inbound do with the add-domain call """ def check_domain(params) when is_list(params) do - Mandrill.request("inbound/check-domain", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("inbound/check-domain", Enum.concat([key: Mandrill.key()], params)) end + def check_domain(domain) do - params = [ - key: Mandrill.key, - domain: domain + params = [ + key: Mandrill.key(), + domain: domain ] + Mandrill.request("inbound/check-domain", params) end @@ -48,13 +52,15 @@ defmodule Mandrill.Inbound do immediately. """ def delete_domain(params) when is_list(params) do - Mandrill.request("inbound/delete-domain", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("inbound/delete-domain", Enum.concat([key: Mandrill.key()], params)) end + def delete_domain(domain) do - params = [ - key: Mandrill.key, - domain: domain + params = [ + key: Mandrill.key(), + domain: domain ] + Mandrill.request("inbound/delete-domain", params) end @@ -63,13 +69,15 @@ defmodule Mandrill.Inbound do inbound domain """ def routes(params) when is_list(params) do - Mandrill.request("inbound/routes", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("inbound/routes", Enum.concat([key: Mandrill.key()], params)) end + def routes(domain) do - params = [ - key: Mandrill.key, - domain: domain + params = [ + key: Mandrill.key(), + domain: domain ] + Mandrill.request("inbound/routes", params) end @@ -77,15 +85,17 @@ defmodule Mandrill.Inbound do Add a new mailbox route to an inbound domain """ def add_route(params) when is_list(params) do - Mandrill.request("inbound/add-route", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("inbound/add-route", Enum.concat([key: Mandrill.key()], params)) end + def add_route(domain, pattern, url) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), domain: domain, pattern: pattern, url: url ] + Mandrill.request("inbound/add-route", params) end @@ -96,15 +106,17 @@ defmodule Mandrill.Inbound do unchanged. """ def update_route(params) when is_list(params) do - Mandrill.request("inbound/update-route", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("inbound/update-route", Enum.concat([key: Mandrill.key()], params)) end + def update_route(id, pattern, url) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), id: id, pattern: pattern, url: url ] + Mandrill.request("inbound/update-route", params) end @@ -112,13 +124,15 @@ defmodule Mandrill.Inbound do Delete an existing inbound mailbox route """ def delete_route(params) when is_list(params) do - Mandrill.request("inbound/delete-route", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("inbound/delete-route", Enum.concat([key: Mandrill.key()], params)) end + def delete_route(id) do - params = [ - key: Mandrill.key, - id: id + params = [ + key: Mandrill.key(), + id: id ] + Mandrill.request("inbound/delete-route", params) end @@ -129,17 +143,19 @@ defmodule Mandrill.Inbound do been sent over SMTP """ def send_raw(params) when is_list(params) do - Mandrill.request("inbound/send-raw", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("inbound/send-raw", Enum.concat([key: Mandrill.key()], params)) end + def send_raw(raw_message, to \\ nil, mail_from, helo, client_address) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), raw_message: raw_message, to: to, mail_from: mail_from, helo: helo, - client_address: client_address + client_address: client_address ] + Mandrill.request("inbound/send-raw", params) end end diff --git a/lib/mandrill/ips.ex b/lib/mandrill/ips.ex index b8de47c..f65c7fc 100644 --- a/lib/mandrill/ips.ex +++ b/lib/mandrill/ips.ex @@ -7,7 +7,7 @@ defmodule Mandrill.Ips do Lists your dedicated IPs. """ def list do - params = [ key: Mandrill.key ] + params = [key: Mandrill.key()] Mandrill.request("ips/list", params) end @@ -16,16 +16,18 @@ defmodule Mandrill.Ips do dedicated ip. """ def info(params) when is_list(params) do - Mandrill.request("ips/info", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("ips/info", Enum.concat([key: Mandrill.key()], params)) end + def info(ip) do - params = [ - key: Mandrill.key, - ip: ip + params = [ + key: Mandrill.key(), + ip: ip ] + Mandrill.request("ips/info", params) end - + @doc """ Requests an additional dedicated IP for your account. Accounts may have one outstanding @@ -33,17 +35,19 @@ defmodule Mandrill.Ips do requests are processed within 24 hours. """ def provision(params) when is_list(params) do - Mandrill.request("ips/provision", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("ips/provision", Enum.concat([key: Mandrill.key()], params)) end + def provision(warmup, pool) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), warmup: warmup, - pool: pool + pool: pool ] + Mandrill.request("ips/provision", params) end - + @doc """ Begins the warmup process for a dedicated IP. During the warmup process, Mandrill will @@ -54,144 +58,162 @@ defmodule Mandrill.Ips do other dedicated IPs in the same pool. """ def start_warmup(params) when is_list(params) do - Mandrill.request("ips/start-warmup", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("ips/start-warmup", Enum.concat([key: Mandrill.key()], params)) end + def start_warmup(ip) do - params = [ - key: Mandrill.key, - ip: ip + params = [ + key: Mandrill.key(), + ip: ip ] + Mandrill.request("ips/start-warmup", params) end - + @doc """ Cancels the warmup process for a dedicated IP. """ def cancel_warmup(params) when is_list(params) do - Mandrill.request("ips/cancel-warmup", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("ips/cancel-warmup", Enum.concat([key: Mandrill.key()], params)) end + def cancel_warmup(ip) do - params = [ - key: Mandrill.key, - ip: ip + params = [ + key: Mandrill.key(), + ip: ip ] + Mandrill.request("ips/cancel-warmup", params) end - + @doc """ Moves a dedicated IP to a different pool. """ def set_pool(params) when is_list(params) do - Mandrill.request("ips/set-pool", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("ips/set-pool", Enum.concat([key: Mandrill.key()], params)) end + def set_pool(ip, pool, create_pool) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), ip: ip, pool: pool, create_pool: create_pool ] + Mandrill.request("ips/set-pool", params) end - + @doc """ Deletes a dedicated IP. This is permanent and cannot be undone. """ def delete(params) when is_list(params) do - Mandrill.request("ips/delete", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("ips/delete", Enum.concat([key: Mandrill.key()], params)) end + def delete(ip) do - params = [ - key: Mandrill.key, - ip: ip + params = [ + key: Mandrill.key(), + ip: ip ] + Mandrill.request("ips/delete", params) end - + @doc """ Lists your dedicated IP pools. """ def list_pools do - params = [ key: Mandrill.key ] + params = [key: Mandrill.key()] Mandrill.request("ips/list-pools", params) end - + @doc """ Describes a single dedicated IP pool. """ def pool_info(params) when is_list(params) do - Mandrill.request("ips/pool-info", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("ips/pool-info", Enum.concat([key: Mandrill.key()], params)) end + def pool_info(pool) do - params = [ - key: Mandrill.key, - pool: pool + params = [ + key: Mandrill.key(), + pool: pool ] + Mandrill.request("ips/pool-info", params) end - + @doc """ Creates a pool and returns it. If a pool already exists with this name, no action will be performed. """ def create_pool(params) when is_list(params) do - Mandrill.request("ips/create-pool", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("ips/create-pool", Enum.concat([key: Mandrill.key()], params)) end + def create_pool(pool) do - params = [ - key: Mandrill.key, - pool: pool + params = [ + key: Mandrill.key(), + pool: pool ] + Mandrill.request("ips/create-pool", params) end - + @doc """ Deletes a pool. A pool must be empty before you can delete it, and you cannot delete your default pool. """ def delete_pool(params) when is_list(params) do - Mandrill.request("ips/delete-pool", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("ips/delete-pool", Enum.concat([key: Mandrill.key()], params)) end + def delete_pool(pool) do - params = [ - key: Mandrill.key, - pool: pool + params = [ + key: Mandrill.key(), + pool: pool ] + Mandrill.request("ips/delete-pool", params) end - + @doc """ Tests whether a domain name is valip for use as the custom reverse DNS for a dedicated IP. """ def check_custom_dns(params) when is_list(params) do - Mandrill.request("ips/check-custom-dns", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("ips/check-custom-dns", Enum.concat([key: Mandrill.key()], params)) end + def check_custom_dns(ip, domain) do - params = [ - key: Mandrill.key, - ip: ip , + params = [ + key: Mandrill.key(), + ip: ip, domain: domain ] + Mandrill.request("ips/check-custom-dns", params) end - + @doc """ Configures the custom DNS name for a dedicated IP. """ def set_custom_dns(params) when is_list(params) do - Mandrill.request("ips/set-custom-dns", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("ips/set-custom-dns", Enum.concat([key: Mandrill.key()], params)) end + def set_custom_dns(ip, domain) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), ip: ip, domain: domain ] + Mandrill.request("ips/set-custom-dns", params) end -end \ No newline at end of file +end diff --git a/lib/mandrill/messages.ex b/lib/mandrill/messages.ex index 5aa2cb8..ad6e450 100644 --- a/lib/mandrill/messages.ex +++ b/lib/mandrill/messages.ex @@ -8,50 +8,55 @@ defmodule Mandrill.Messages do Mandrill """ def send(params) when is_list(params) do - Mandrill.request("messages/send", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("messages/send", Enum.concat([key: Mandrill.key()], params)) end + def send(message, async, ip_pool, send_at) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), message: message, async: async, ip_pool: ip_pool, send_at: send_at ] + Mandrill.request("messages/send", params) end - + @doc """ Send a new transactional message through Mandrill using a template """ def send_template(params) when is_list(params) do - Mandrill.request("messages/send-template", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("messages/send-template", Enum.concat([key: Mandrill.key()], params)) end + def send_template(template_name, template_content, message, async, ip_pool, send_at) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), template_name: template_name, template_content: template_content, message: message, async: async, ip_pool: ip_pool, - send_at: send_at + send_at: send_at ] + Mandrill.request("messages/send-template", params) end - + @doc """ Search the content of recently sent messages and optionally narrow by date range, tags and senders """ def search(params) when is_list(params) do - Mandrill.request("messages/search", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("messages/search", Enum.concat([key: Mandrill.key()], params)) end + def search(query, date_from, date_to, tags, senders, api_keys, limit) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), query: query, date_from: date_from, date_to: date_to, @@ -60,86 +65,105 @@ defmodule Mandrill.Messages do api_keys: api_keys, limit: limit ] + Mandrill.request("messages/search", params) end - + @doc """ Search the content of recently sent messages and return the aggregated hourly stats for matching messages """ def search_time_series(params) when is_list(params) do - Mandrill.request("messages/search-time-series", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("messages/search-time-series", Enum.concat([key: Mandrill.key()], params)) end + def search_time_series(query, date_from, date_to, tags, senders) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), query: query, date_from: date_from, date_to: date_to, tags: tags, - senders: senders + senders: senders ] + Mandrill.request("messages/search-time-series", params) end - + @doc """ Get the information for a single recently sent message """ def info(params) when is_list(params) do - Mandrill.request("messages/info", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("messages/info", Enum.concat([key: Mandrill.key()], params)) end + def info(id) do - params = [ - key: Mandrill.key, - id: id + params = [ + key: Mandrill.key(), + id: id ] + Mandrill.request("messages/info", params) end - + @doc """ Get the full content of a recently sent message """ def content(params) when is_list(params) do - Mandrill.request("messages/content", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("messages/content", Enum.concat([key: Mandrill.key()], params)) end + def content(id) do - params = [ - key: Mandrill.key, - id: id + params = [ + key: Mandrill.key(), + id: id ] + Mandrill.request("messages/content", params) end - + @doc """ Parse the full MIME document for an email message, returning the content of the message broken into its constituent pieces """ def parse(params) when is_list(params) do - Mandrill.request("messages/parse", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("messages/parse", Enum.concat([key: Mandrill.key()], params)) end + def parse(raw_message) do - params = [ - key: Mandrill.key, - raw_message: raw_message + params = [ + key: Mandrill.key(), + raw_message: raw_message ] + Mandrill.request("messages/parse", params) end - + @doc """ Take a raw MIME document for a message, and send it exactly as if it were sent through Mandrill's SMTP servers """ def send_raw(params) when is_list(params) do - Mandrill.request("messages/send-raw", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("messages/send-raw", Enum.concat([key: Mandrill.key()], params)) end - def send_raw(raw_message, from_email \\ nil, from_name \\ nil, to \\ nil, async, ip_pool, send_at, return_path_domain) do - params = [ - key: Mandrill.key, + + def send_raw( + raw_message, + from_email \\ nil, + from_name \\ nil, + to \\ nil, + async, + ip_pool, + send_at, + return_path_domain + ) do + params = [ + key: Mandrill.key(), raw_message: raw_message, from_email: from_email, from_name: from_name, @@ -149,50 +173,57 @@ defmodule Mandrill.Messages do send_at: send_at, return_path_domain: return_path_domain ] + Mandrill.request("messages/send-raw", params) end - + @doc """ Queries your scheduled emails by sender or recipient, or both. """ def list_scheduled(params) when is_list(params) do - Mandrill.request("messages/list-scheduled", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("messages/list-scheduled", Enum.concat([key: Mandrill.key()], params)) end + def list_scheduled(to) do - params = [ - key: Mandrill.key, - to: to + params = [ + key: Mandrill.key(), + to: to ] + Mandrill.request("messages/list-scheduled", params) end - + @doc """ Cancels a scheduled email. """ def cancel_scheduled(params) when is_list(params) do - Mandrill.request("messages/cancel-scheduled", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("messages/cancel-scheduled", Enum.concat([key: Mandrill.key()], params)) end + def cancel_scheduled(id) do - params = [ - key: Mandrill.key, - id: id + params = [ + key: Mandrill.key(), + id: id ] + Mandrill.request("messages/cancel-scheduled", params) end - + @doc """ Reschedules a scheduled email. """ def reschedule(params) when is_list(params) do - Mandrill.request("messages/reschedule", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("messages/reschedule", Enum.concat([key: Mandrill.key()], params)) end + def reschedule(id, send_at) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), id: id, send_At: send_at ] + Mandrill.request("messages/reschedule", params) end end diff --git a/lib/mandrill/rejects.ex b/lib/mandrill/rejects.ex index c5b2c0d..1a8ea53 100644 --- a/lib/mandrill/rejects.ex +++ b/lib/mandrill/rejects.ex @@ -3,7 +3,7 @@ defmodule Mandrill.Rejects do Rejects calls for Mandrill. """ - @doc """ + @doc """ Adds an email to your email rejection blacklist. Addresses that you add manually will never expire and there is no @@ -13,19 +13,21 @@ defmodule Mandrill.Rejects do have no effect. """ def add(params) when is_list(params) do - Mandrill.request("rejects/add", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("rejects/add", Enum.concat([key: Mandrill.key()], params)) end + def add(email, comment, subaccount) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), email: email, comment: comment, subaccount: subaccount ] + Mandrill.request("rejects/add", params) end - @doc """ + @doc """ Retrieves your email rejection blacklist. You can provide an email address to limit the results. Returns up to 1000 results. @@ -34,15 +36,17 @@ defmodule Mandrill.Rejects do include_expired to true to include them. """ def list(params) when is_list(params) do - Mandrill.request("rejects/list", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("rejects/list", Enum.concat([key: Mandrill.key()], params)) end + def list(email, include_expired, subaccount) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), email: email, include_expired: include_expired, subaccount: subaccount ] + Mandrill.request("rejects/list", params) end @@ -54,14 +58,16 @@ defmodule Mandrill.Rejects do your reputation. """ def delete(params) when is_list(params) do - Mandrill.request("rejects/delete", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("rejects/delete", Enum.concat([key: Mandrill.key()], params)) end + def delete(email, subaccount) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), email: email, subaccount: subaccount ] + Mandrill.request("rejects/delete", params) end -end \ No newline at end of file +end diff --git a/lib/mandrill/senders.ex b/lib/mandrill/senders.ex index 1175e11..9ee854b 100644 --- a/lib/mandrill/senders.ex +++ b/lib/mandrill/senders.ex @@ -8,7 +8,7 @@ defmodule Mandrill.Senders do use this account. """ def list do - params = [ key: Mandrill.key ] + params = [key: Mandrill.key()] Mandrill.request("senders/list", params) end @@ -17,7 +17,7 @@ defmodule Mandrill.Senders do been added to this account. """ def domains do - params = [ key: Mandrill.key ] + params = [key: Mandrill.key()] Mandrill.request("senders/domains", params) end @@ -28,13 +28,15 @@ defmodule Mandrill.Senders do to add them ahead of time. """ def add_domain(params) when is_list(params) do - Mandrill.request("senders/add-domain", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("senders/add-domain", Enum.concat([key: Mandrill.key()], params)) end + def add_domain(domain) do - params = [ - key: Mandrill.key, - domain: domain + params = [ + key: Mandrill.key(), + domain: domain ] + Mandrill.request("senders/add-domain", params) end @@ -45,13 +47,15 @@ defmodule Mandrill.Senders do added automatically. """ def check_domain(params) when is_list(params) do - Mandrill.request("senders/check-domain", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("senders/check-domain", Enum.concat([key: Mandrill.key()], params)) end + def check_domain(domain) do - params = [ - key: Mandrill.key, - domain: domain + params = [ + key: Mandrill.key(), + domain: domain ] + Mandrill.request("senders/check-domain", params) end @@ -68,14 +72,16 @@ defmodule Mandrill.Senders do from sending mail signed by your domain. """ def verify_domain(params) when is_list(params) do - Mandrill.request("senders/verify-domain", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("senders/verify-domain", Enum.concat([key: Mandrill.key()], params)) end + def verify_domain(domain, mailbox) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), domain: domain, mailbox: mailbox ] + Mandrill.request("senders/verify-domain", params) end @@ -85,13 +91,15 @@ defmodule Mandrill.Senders do recent stats """ def info(params) when is_list(params) do - Mandrill.request("senders/info", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("senders/info", Enum.concat([key: Mandrill.key()], params)) end + def info(address) do - params = [ - key: Mandrill.key, - address: address + params = [ + key: Mandrill.key(), + address: address ] + Mandrill.request("senders/info", params) end @@ -100,13 +108,15 @@ defmodule Mandrill.Senders do for the last 30 days) for a sender """ def time_series(params) when is_list(params) do - Mandrill.request("senders/time-series", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("senders/time-series", Enum.concat([key: Mandrill.key()], params)) end + def time_series(address) do - params = [ - key: Mandrill.key, - address: address + params = [ + key: Mandrill.key(), + address: address ] + Mandrill.request("senders/time-series", params) end -end \ No newline at end of file +end diff --git a/lib/mandrill/subaccounts.ex b/lib/mandrill/subaccounts.ex index 8784cfb..75fd6a1 100644 --- a/lib/mandrill/subaccounts.ex +++ b/lib/mandrill/subaccounts.ex @@ -9,13 +9,15 @@ defmodule Mandrill.Subaccounts do prefix """ def list(params) when is_list(params) do - Mandrill.request("subaccounts/list", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("subaccounts/list", Enum.concat([key: Mandrill.key()], params)) end + def list(q) do - params = [ - key: Mandrill.key, - q: q + params = [ + key: Mandrill.key(), + q: q ] + Mandrill.request("subaccounts/list", params) end @@ -23,16 +25,18 @@ defmodule Mandrill.Subaccounts do Add a new subaccount """ def add(params) when is_list(params) do - Mandrill.request("subaccounts/add", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("subaccounts/add", Enum.concat([key: Mandrill.key()], params)) end + def add(id, name, notes, custom_quota) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), id: id, name: name, notes: notes, custom_quota: custom_quota ] + Mandrill.request("subaccounts/add", params) end @@ -41,13 +45,15 @@ defmodule Mandrill.Subaccounts do return the data about it """ def info(params) when is_list(params) do - Mandrill.request("subaccounts/info", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("subaccounts/info", Enum.concat([key: Mandrill.key()], params)) end + def info(id) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), id: id ] + Mandrill.request("subaccounts/info", params) end @@ -55,16 +61,18 @@ defmodule Mandrill.Subaccounts do Update an existing subaccount """ def update(params) when is_list(params) do - Mandrill.request("subaccounts/update", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("subaccounts/update", Enum.concat([key: Mandrill.key()], params)) end + def update(id, name, notes, custom_quota) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), id: id, name: name, notes: notes, custom_quota: custom_quota ] + Mandrill.request("subaccounts/update", params) end @@ -75,13 +83,15 @@ defmodule Mandrill.Subaccounts do sending calls to this subaccount will fail. """ def delete(params) when is_list(params) do - Mandrill.request("subaccounts/delete", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("subaccounts/delete", Enum.concat([key: Mandrill.key()], params)) end + def delete(id) do - params = [ - key: Mandrill.key, - id: id + params = [ + key: Mandrill.key(), + id: id ] + Mandrill.request("subaccounts/delete", params) end @@ -92,13 +102,15 @@ defmodule Mandrill.Subaccounts do subaccount is resumed. """ def pause(params) when is_list(params) do - Mandrill.request("subaccounts/pause", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("subaccounts/pause", Enum.concat([key: Mandrill.key()], params)) end + def pause(id) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), id: id ] + Mandrill.request("subaccounts/pause", params) end @@ -106,13 +118,15 @@ defmodule Mandrill.Subaccounts do Resume a paused subaccount's sending """ def resume(params) when is_list(params) do - Mandrill.request("subaccounts/resume", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("subaccounts/resume", Enum.concat([key: Mandrill.key()], params)) end + def resume(id) do - params = [ - key: Mandrill.key, - id: id + params = [ + key: Mandrill.key(), + id: id ] + Mandrill.request("subaccounts/resume", params) end -end \ No newline at end of file +end diff --git a/lib/mandrill/supervisor.ex b/lib/mandrill/supervisor.ex index 54498eb..c7eee87 100644 --- a/lib/mandrill/supervisor.ex +++ b/lib/mandrill/supervisor.ex @@ -15,4 +15,4 @@ defmodule Mandrill.Supervisor do # for other strategies and supported options supervise(children, strategy: :one_for_one) end -end \ No newline at end of file +end diff --git a/lib/mandrill/tags.ex b/lib/mandrill/tags.ex index e4ffb90..a8dc346 100644 --- a/lib/mandrill/tags.ex +++ b/lib/mandrill/tags.ex @@ -8,7 +8,7 @@ defmodule Mandrill.Tags do information """ def list do - params = [ key: Mandrill.key ] + params = [key: Mandrill.key()] Mandrill.request("tags/list", params) end @@ -20,13 +20,15 @@ defmodule Mandrill.Tags do operation, so use it carefully. """ def delete(params) when is_list(params) do - Mandrill.request("tags/delete", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("tags/delete", Enum.concat([key: Mandrill.key()], params)) end + def delete(tag) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), tag: tag ] + Mandrill.request("tags/delete", params) end @@ -36,13 +38,15 @@ defmodule Mandrill.Tags do stats """ def info(params) when is_list(params) do - Mandrill.request("tags/info", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("tags/info", Enum.concat([key: Mandrill.key()], params)) end + def info(tag) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), tag: tag ] + Mandrill.request("tags/info", params) end @@ -51,13 +55,15 @@ defmodule Mandrill.Tags do for the last 30 days) for a tag """ def time_series(params) when is_list(params) do - Mandrill.request("tags/time-series", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("tags/time-series", Enum.concat([key: Mandrill.key()], params)) end + def time_series(tag) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), tag: tag ] + Mandrill.request("tags/time-series", params) end @@ -66,7 +72,7 @@ defmodule Mandrill.Tags do for the last 30 days) for all tags """ def all_time_series do - params = [ key: Mandrill.key ] + params = [key: Mandrill.key()] Mandrill.request("tags/all-time-series", params) end -end \ No newline at end of file +end diff --git a/lib/mandrill/templates.ex b/lib/mandrill/templates.ex index bd75b3d..feab50e 100644 --- a/lib/mandrill/templates.ex +++ b/lib/mandrill/templates.ex @@ -7,12 +7,13 @@ defmodule Mandrill.Templates do Add a new template """ def add(params) when is_list(params) do - Mandrill.request("templates/add", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("templates/add", Enum.concat([key: Mandrill.key()], params)) end + def add(name, from_email, from_name, subject, code, text, publish, labels) do - params = [ - key: Mandrill.key, - name: name, + params = [ + key: Mandrill.key(), + name: name, from_email: from_email, from_name: from_name, subject: subject, @@ -21,6 +22,7 @@ defmodule Mandrill.Templates do publish: publish, labels: labels ] + Mandrill.request("templates/add", params) end @@ -29,13 +31,15 @@ defmodule Mandrill.Templates do template """ def info(params) when is_list(params) do - Mandrill.request("templates/info", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("templates/info", Enum.concat([key: Mandrill.key()], params)) end + def info(name) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), name: name ] + Mandrill.request("templates/info", params) end @@ -45,11 +49,12 @@ defmodule Mandrill.Templates do values will remain unchanged. """ def update(params) when is_list(params) do - Mandrill.request("templates/update", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("templates/update", Enum.concat([key: Mandrill.key()], params)) end + def update(name, from_email, from_name, subject, code, text, publish, labels) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), name: name, from_email: from_email, from_name: from_name, @@ -57,8 +62,9 @@ defmodule Mandrill.Templates do code: code, text: text, publish: publish, - labels: labels + labels: labels ] + Mandrill.request("templates/update", params) end @@ -69,13 +75,15 @@ defmodule Mandrill.Templates do previously in draft. """ def publish(params) when is_list(params) do - Mandrill.request("templates/publish", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("templates/publish", Enum.concat([key: Mandrill.key()], params)) end + def publish(name) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), name: name ] + Mandrill.request("templates/publish", params) end @@ -83,13 +91,15 @@ defmodule Mandrill.Templates do Delete a template """ def delete(params) when is_list(params) do - Mandrill.request("templates/delete", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("templates/delete", Enum.concat([key: Mandrill.key()], params)) end + def delete(name) do - params = [ - key: Mandrill.key, - name: name + params = [ + key: Mandrill.key(), + name: name ] + Mandrill.request("templates/delete", params) end @@ -98,13 +108,15 @@ defmodule Mandrill.Templates do available to this user """ def list(params) when is_list(params) do - Mandrill.request("templates/list", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("templates/list", Enum.concat([key: Mandrill.key()], params)) end + def list(label) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), label: label ] + Mandrill.request("templates/list", params) end @@ -113,13 +125,15 @@ defmodule Mandrill.Templates do the last 30 days) for a template """ def time_series(params) when is_list(params) do - Mandrill.request("templates/time-series", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("templates/time-series", Enum.concat([key: Mandrill.key()], params)) end + def time_series(name) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), name: name ] + Mandrill.request("templates/time-series", params) end @@ -128,15 +142,17 @@ defmodule Mandrill.Templates do into a template, returning the HTML that results """ def render(params) when is_list(params) do - Mandrill.request("templates/render", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("templates/render", Enum.concat([key: Mandrill.key()], params)) end + def render(template_name, template_content, merge_vars) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), template_name: template_name, template_content: template_content, - merge_vars: merge_vars + merge_vars: merge_vars ] + Mandrill.request("templates/render", params) end -end \ No newline at end of file +end diff --git a/lib/mandrill/urls.ex b/lib/mandrill/urls.ex index d82b82c..cab10b9 100644 --- a/lib/mandrill/urls.ex +++ b/lib/mandrill/urls.ex @@ -7,7 +7,7 @@ defmodule Mandrill.Urls do Get the 100 most clicked URLs """ def list do - params = [ key: Mandrill.key ] + params = [key: Mandrill.key()] Mandrill.request("urls/list", params) end @@ -16,13 +16,15 @@ defmodule Mandrill.Urls do match the search query given """ def search(params) when is_list(params) do - Mandrill.request("urls/search", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("urls/search", Enum.concat([key: Mandrill.key()], params)) end + def search(q) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), q: q ] + Mandrill.request("urls/search", params) end @@ -31,13 +33,15 @@ defmodule Mandrill.Urls do for the last 30 days) for a url """ def time_series(params) when is_list(params) do - Mandrill.request("urls/time-series", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("urls/time-series", Enum.concat([key: Mandrill.key()], params)) end + def time_series(url) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), url: url ] + Mandrill.request("urls/time-series", params) end @@ -46,7 +50,7 @@ defmodule Mandrill.Urls do for this account """ def tracking_domains do - params = [ key: Mandrill.key ] + params = [key: Mandrill.key()] Mandrill.request("urls/tracking-domain", params) end @@ -54,13 +58,15 @@ defmodule Mandrill.Urls do Add a tracking domain to your account """ def add_tracking_domain(params) when is_list(params) do - Mandrill.request("urls/add-tracking-domain", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("urls/add-tracking-domain", Enum.concat([key: Mandrill.key()], params)) end + def add_tracking_domain(domain) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), domain: domain ] + Mandrill.request("urls/add-tracking-domain", params) end @@ -70,13 +76,15 @@ defmodule Mandrill.Urls do already with the add-tracking-domain call """ def check_tracking_domain(params) when is_list(params) do - Mandrill.request("urls/check-tracking-domain", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("urls/check-tracking-domain", Enum.concat([key: Mandrill.key()], params)) end + def check_tracking_domain(domain) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), domain: domain ] + Mandrill.request("urls/check-tracking-domain", params) end -end \ No newline at end of file +end diff --git a/lib/mandrill/users.ex b/lib/mandrill/users.ex index be46bcb..43bd594 100644 --- a/lib/mandrill/users.ex +++ b/lib/mandrill/users.ex @@ -8,7 +8,7 @@ defmodule Mandrill.Users do API-connected user """ def info do - params = [ key: Mandrill.key ] + params = [key: Mandrill.key()] Mandrill.request("users/info", params) end @@ -17,26 +17,26 @@ defmodule Mandrill.Users do a ping """ def ping do - params = [ key: Mandrill.key ] + params = [key: Mandrill.key()] Mandrill.request("users/ping", params) end - + @doc """ Validate an API key and respond to a ping (anal JSON parser version) """ def ping2 do - params = [ key: Mandrill.key ] + params = [key: Mandrill.key()] Mandrill.request("users/ping2", params) end - + @doc """ Return the senders that have tried to use this account, both verified and unverified """ def senders do - params = [ key: Mandrill.key ] + params = [key: Mandrill.key()] Mandrill.request("users/senders", params) end -end \ No newline at end of file +end diff --git a/lib/mandrill/webhooks.ex b/lib/mandrill/webhooks.ex index 3b59cbb..5b00db8 100644 --- a/lib/mandrill/webhooks.ex +++ b/lib/mandrill/webhooks.ex @@ -8,7 +8,7 @@ defmodule Mandrill.Webhooks do defined on the account """ def list do - params = [ key: Mandrill.key ] + params = [key: Mandrill.key()] Mandrill.request("webhooks/list", params) end @@ -16,15 +16,17 @@ defmodule Mandrill.Webhooks do Add a new webhook """ def add(params) when is_list(params) do - Mandrill.request("webhooks/add", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("webhooks/add", Enum.concat([key: Mandrill.key()], params)) end + def add(url, description, events) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), url: url, description: description, events: events ] + Mandrill.request("webhooks/add", params) end @@ -33,13 +35,15 @@ defmodule Mandrill.Webhooks do webhook, return the data about it """ def info(params) when is_list(params) do - Mandrill.request("webhooks/info", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("webhooks/info", Enum.concat([key: Mandrill.key()], params)) end + def info(id) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), id: id ] + Mandrill.request("webhooks/info", params) end @@ -47,16 +51,18 @@ defmodule Mandrill.Webhooks do Update an existing webhook """ def update(params) when is_list(params) do - Mandrill.request("webhooks/update", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("webhooks/update", Enum.concat([key: Mandrill.key()], params)) end + def update(id, url, description, events) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), id: id, url: url, description: description, events: events ] + Mandrill.request("webhooks/update", params) end @@ -64,13 +70,15 @@ defmodule Mandrill.Webhooks do Delete an existing webhook """ def delete(params) when is_list(params) do - Mandrill.request("webhooks/delete", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("webhooks/delete", Enum.concat([key: Mandrill.key()], params)) end + def delete(id) do - params = [ - key: Mandrill.key, + params = [ + key: Mandrill.key(), id: id ] + Mandrill.request("webhooks/delete", params) end -end \ No newline at end of file +end diff --git a/lib/mandrill/whitelists.ex b/lib/mandrill/whitelists.ex index b76e5b0..c5e6c2b 100644 --- a/lib/mandrill/whitelists.ex +++ b/lib/mandrill/whitelists.ex @@ -10,13 +10,15 @@ defmodule Mandrill.Whitelists do will be removed automatically. """ def add(params) when is_list(params) do - Mandrill.request("whitelists/add", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("whitelists/add", Enum.concat([key: Mandrill.key()], params)) end + def add(email) do - params = [ - key: Mandrill.key, - email: email + params = [ + key: Mandrill.key(), + email: email ] + Mandrill.request("whitelists/add", params) end @@ -27,13 +29,15 @@ defmodule Mandrill.Whitelists do Returns up to 1000 results. """ def list(params) when is_list(params) do - Mandrill.request("whitelists/list", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("whitelists/list", Enum.concat([key: Mandrill.key()], params)) end + def list(email) do - params = [ - key: Mandrill.key, - email: email + params = [ + key: Mandrill.key(), + email: email ] + Mandrill.request("whitelists/list", params) end @@ -42,13 +46,15 @@ defmodule Mandrill.Whitelists do whitelist. """ def delete(params) when is_list(params) do - Mandrill.request("whitelists/delete", Enum.concat([key: Mandrill.key], params)) + Mandrill.request("whitelists/delete", Enum.concat([key: Mandrill.key()], params)) end + def delete(email) do - params = [ - key: Mandrill.key, - email: email + params = [ + key: Mandrill.key(), + email: email ] + Mandrill.request("whitelists/delete", params) end -end \ No newline at end of file +end diff --git a/mix.exs b/mix.exs index 31eae4c..e1584f4 100644 --- a/mix.exs +++ b/mix.exs @@ -2,25 +2,26 @@ defmodule Mandrill.Mixfile do use Mix.Project def project do - [ app: :mandrill, + [ + app: :mandrill, version: "0.5.0", elixir: "~> 1.0", description: description, package: package, - deps: deps ] + deps: deps + ] end def application do - [ mod: { Mandrill, [] }, - applications: [:httpoison, :exjsx] ] + [mod: {Mandrill, []}, applications: [:httpoison, :exjsx]] end defp deps do [ - { :httpoison, "~> 0.6" }, - { :exjsx, "~> 3.2.0", app: false }, - { :ex_doc, "~> 0.6.1", only: :docs }, - { :earmark, "~> 0.1.12", only: :docs } + {:httpoison, "~> 0.6"}, + {:exjsx, "~> 3.2.0", app: false}, + {:ex_doc, "~> 0.6.1", only: :docs}, + {:earmark, "~> 0.1.12", only: :docs} ] end @@ -33,9 +34,11 @@ defmodule Mandrill.Mixfile do end defp package do - [ files: [ "lib", "mix.exs", "README.md", "LICENSE" ], - maintainers: [ "Shane Logsdon" ], - licenses: [ "MIT" ], - links: %{ "GitHub" => "https://github.com/slogsdon/mandrill-elixir" } ] + [ + files: ["lib", "mix.exs", "README.md", "LICENSE"], + maintainers: ["Shane Logsdon"], + licenses: ["MIT"], + links: %{"GitHub" => "https://github.com/slogsdon/mandrill-elixir"} + ] end end diff --git a/test/mandrill_test.exs b/test/mandrill_test.exs index 1261d11..1c5ee73 100644 --- a/test/mandrill_test.exs +++ b/test/mandrill_test.exs @@ -6,11 +6,14 @@ defmodule MandrillTest do end test "ping returns pong" do - Mandrill.start - assert Mandrill.Users.ping == "PONG!" + Mandrill.start() + assert Mandrill.Users.ping() == "PONG!" end test "process_response_body returns a map with string keys" do - assert Mandrill.process_response_body("{\"language\": \"elixir\", \"awesome\": true}") == %{"awesome" => true, "language" => "elixir"} + assert Mandrill.process_response_body("{\"language\": \"elixir\", \"awesome\": true}") == %{ + "awesome" => true, + "language" => "elixir" + } end end diff --git a/test/test_helper.exs b/test/test_helper.exs index 4b8b246..869559e 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1 +1 @@ -ExUnit.start +ExUnit.start() From a983eae585887a89e25df2ee15b3df05b5bc448b Mon Sep 17 00:00:00 2001 From: Nick Kezhaya Date: Tue, 19 Nov 2019 16:40:02 -0700 Subject: [PATCH 02/12] Updated deps, removed JSON encoder dependency --- mix.exs | 12 +++++------- mix.lock | 24 ++++++++++++++++-------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/mix.exs b/mix.exs index e1584f4..aded91b 100644 --- a/mix.exs +++ b/mix.exs @@ -6,9 +6,9 @@ defmodule Mandrill.Mixfile do app: :mandrill, version: "0.5.0", elixir: "~> 1.0", - description: description, - package: package, - deps: deps + description: description(), + package: package(), + deps: deps() ] end @@ -18,10 +18,8 @@ defmodule Mandrill.Mixfile do defp deps do [ - {:httpoison, "~> 0.6"}, - {:exjsx, "~> 3.2.0", app: false}, - {:ex_doc, "~> 0.6.1", only: :docs}, - {:earmark, "~> 0.1.12", only: :docs} + {:httpoison, ">= 0.0.0"}, + {:ex_doc, ">= 0.0.0"} ] end diff --git a/mix.lock b/mix.lock index 3ba65f5..59af6be 100644 --- a/mix.lock +++ b/mix.lock @@ -1,8 +1,16 @@ -%{"earmark": {:hex, :earmark, "0.1.13"}, - "ex_doc": {:hex, :ex_doc, "0.6.2"}, - "exjsx": {:hex, :exjsx, "3.2.0"}, - "hackney": {:hex, :hackney, "1.0.6"}, - "httpoison": {:hex, :httpoison, "0.6.2"}, - "idna": {:hex, :idna, "1.0.2"}, - "jsx": {:hex, :jsx, "2.6.2"}, - "ssl_verify_hostname": {:hex, :ssl_verify_hostname, "1.0.1"}} +%{ + "certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"}, + "earmark": {:hex, :earmark, "1.4.2", "3aa0bd23bc4c61cf2f1e5d752d1bb470560a6f8539974f767a38923bb20e1d7f", [:mix], [], "hexpm"}, + "ex_doc": {:hex, :ex_doc, "0.21.2", "caca5bc28ed7b3bdc0b662f8afe2bee1eedb5c3cf7b322feeeb7c6ebbde089d6", [:mix], [{:earmark, "~> 1.3.3 or ~> 1.4", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"}, + "hackney": {:hex, :hackney, "1.15.2", "07e33c794f8f8964ee86cebec1a8ed88db5070e52e904b8f12209773c1036085", [:rebar3], [{:certifi, "2.5.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.5", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"}, + "httpoison": {:hex, :httpoison, "1.6.2", "ace7c8d3a361cebccbed19c283c349b3d26991eff73a1eaaa8abae2e3c8089b6", [:mix], [{:hackney, "~> 1.15 and >= 1.15.2", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"}, + "idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"}, + "makeup": {:hex, :makeup, "1.0.0", "671df94cf5a594b739ce03b0d0316aa64312cee2574b6a44becb83cd90fb05dc", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"}, + "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm"}, + "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm"}, + "nimble_parsec": {:hex, :nimble_parsec, "0.5.2", "1d71150d5293d703a9c38d4329da57d3935faed2031d64bc19e77b654ef2d177", [:mix], [], "hexpm"}, + "parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm"}, + "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.5", "6eaf7ad16cb568bb01753dbbd7a95ff8b91c7979482b95f38443fe2c8852a79b", [:make, :mix, :rebar3], [], "hexpm"}, + "unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm"}, +} From 46fb00d0bc6034a21b0fc72d5dabe57eb42d0521 Mon Sep 17 00:00:00 2001 From: Nick Kezhaya Date: Tue, 19 Nov 2019 16:49:38 -0700 Subject: [PATCH 03/12] Configurable :json_library argument --- lib/mandrill.ex | 8 ++++++-- mix.exs | 8 ++++++-- mix.lock | 1 + 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/mandrill.ex b/lib/mandrill.ex index 3942da1..7216711 100644 --- a/lib/mandrill.ex +++ b/lib/mandrill.ex @@ -28,7 +28,7 @@ defmodule Mandrill do Returns Record or ArgumentError """ def process_response_body(body) do - JSX.decode!(body) + json_library().decode!(body) end @doc """ @@ -39,7 +39,7 @@ defmodule Mandrill do Returns dict """ def request(endpoint, body) do - Mandrill.post!(endpoint, JSX.encode!(body)).body + Mandrill.post!(endpoint, json_library().encode!(body)).body end @doc """ @@ -51,4 +51,8 @@ defmodule Mandrill do Application.get_env(:mandrill, :key) || System.get_env("MANDRILL_KEY") end + + def json_library do + Application.get_env(:mandrill, :json_library, Jason) + end end diff --git a/mix.exs b/mix.exs index aded91b..b2ff91e 100644 --- a/mix.exs +++ b/mix.exs @@ -6,6 +6,8 @@ defmodule Mandrill.Mixfile do app: :mandrill, version: "0.5.0", elixir: "~> 1.0", + build_embedded: Mix.env() == :prod, + start_permanent: Mix.env() == :prod, description: description(), package: package(), deps: deps() @@ -13,13 +15,14 @@ defmodule Mandrill.Mixfile do end def application do - [mod: {Mandrill, []}, applications: [:httpoison, :exjsx]] + [] end defp deps do [ {:httpoison, ">= 0.0.0"}, - {:ex_doc, ">= 0.0.0"} + {:ex_doc, ">= 0.0.0"}, + {:jason, ">= 0.0.0", only: :test} ] end @@ -33,6 +36,7 @@ defmodule Mandrill.Mixfile do defp package do [ + name: :mandrill, files: ["lib", "mix.exs", "README.md", "LICENSE"], maintainers: ["Shane Logsdon"], licenses: ["MIT"], diff --git a/mix.lock b/mix.lock index 59af6be..e1c8011 100644 --- a/mix.lock +++ b/mix.lock @@ -5,6 +5,7 @@ "hackney": {:hex, :hackney, "1.15.2", "07e33c794f8f8964ee86cebec1a8ed88db5070e52e904b8f12209773c1036085", [:rebar3], [{:certifi, "2.5.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.5", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"}, "httpoison": {:hex, :httpoison, "1.6.2", "ace7c8d3a361cebccbed19c283c349b3d26991eff73a1eaaa8abae2e3c8089b6", [:mix], [{:hackney, "~> 1.15 and >= 1.15.2", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"}, "idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"}, + "jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"}, "makeup": {:hex, :makeup, "1.0.0", "671df94cf5a594b739ce03b0d0316aa64312cee2574b6a44becb83cd90fb05dc", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"}, "makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm"}, From d8d8eb5fb77e2b5b4c558df5bbbdd507eb101241 Mon Sep 17 00:00:00 2001 From: Nick Kezhaya Date: Tue, 19 Nov 2019 18:40:48 -0600 Subject: [PATCH 04/12] Switch to Tesla --- config/config.exs | 3 +++ lib/mandrill.ex | 16 ++++++---------- mix.exs | 5 +++-- mix.lock | 2 ++ test/mandrill_test.exs | 1 - 5 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 config/config.exs diff --git a/config/config.exs b/config/config.exs new file mode 100644 index 0000000..41db7cc --- /dev/null +++ b/config/config.exs @@ -0,0 +1,3 @@ +import Config + +config :tesla, adapter: Tesla.Adapter.Hackney diff --git a/lib/mandrill.ex b/lib/mandrill.ex index 7216711..34db982 100644 --- a/lib/mandrill.ex +++ b/lib/mandrill.ex @@ -2,14 +2,10 @@ defmodule Mandrill do @moduledoc """ An HTTP client for Mandrill. """ + use Tesla - # Let's build on top of HTTPoison - use Application - use HTTPoison.Base - - def start(_type, _args) do - Mandrill.Supervisor.start_link() - end + plug(Tesla.Middleware.BaseUrl, "https://mandrillapp.com/api/1.0/") + plug(Tesla.Middleware.JSON) @doc """ Creates the URL for our endpoint. @@ -39,7 +35,8 @@ defmodule Mandrill do Returns dict """ def request(endpoint, body) do - Mandrill.post!(endpoint, json_library().encode!(body)).body + body = json_library().encode!(Map.new(body)) + post!(endpoint <> ".json", body).body end @doc """ @@ -48,8 +45,7 @@ defmodule Mandrill do Returns binary """ def key do - Application.get_env(:mandrill, :key) || - System.get_env("MANDRILL_KEY") + Application.get_env(:mandrill, :key) || System.get_env("MANDRILL_KEY") end def json_library do diff --git a/mix.exs b/mix.exs index b2ff91e..a6467c6 100644 --- a/mix.exs +++ b/mix.exs @@ -20,9 +20,10 @@ defmodule Mandrill.Mixfile do defp deps do [ - {:httpoison, ">= 0.0.0"}, + {:tesla, ">= 0.0.0"}, {:ex_doc, ">= 0.0.0"}, - {:jason, ">= 0.0.0", only: :test} + {:jason, ">= 0.0.0", only: :test, optional: true}, + {:hackney, ">= 0.0.0", only: :test} ] end diff --git a/mix.lock b/mix.lock index e1c8011..ff1d1c2 100644 --- a/mix.lock +++ b/mix.lock @@ -9,9 +9,11 @@ "makeup": {:hex, :makeup, "1.0.0", "671df94cf5a594b739ce03b0d0316aa64312cee2574b6a44becb83cd90fb05dc", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"}, "makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm"}, + "mime": {:hex, :mime, "1.3.1", "30ce04ab3175b6ad0bdce0035cba77bba68b813d523d1aac73d9781b4d193cf8", [:mix], [], "hexpm"}, "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm"}, "nimble_parsec": {:hex, :nimble_parsec, "0.5.2", "1d71150d5293d703a9c38d4329da57d3935faed2031d64bc19e77b654ef2d177", [:mix], [], "hexpm"}, "parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.5", "6eaf7ad16cb568bb01753dbbd7a95ff8b91c7979482b95f38443fe2c8852a79b", [:make, :mix, :rebar3], [], "hexpm"}, + "tesla": {:hex, :tesla, "1.3.0", "f35d72f029e608f9cdc6f6d6fcc7c66cf6d6512a70cfef9206b21b8bd0203a30", [:mix], [{:castore, "~> 0.1", [hex: :castore, repo: "hexpm", optional: true]}, {:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:gun, "~> 1.3", [hex: :gun, repo: "hexpm", optional: true]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "~> 4.4.0", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 0.4", [hex: :mint, repo: "hexpm", optional: true]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.3", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm"}, } diff --git a/test/mandrill_test.exs b/test/mandrill_test.exs index 1c5ee73..d9d4a45 100644 --- a/test/mandrill_test.exs +++ b/test/mandrill_test.exs @@ -6,7 +6,6 @@ defmodule MandrillTest do end test "ping returns pong" do - Mandrill.start() assert Mandrill.Users.ping() == "PONG!" end From 2581f326749f7dc4d6b737698f1517f91fee071d Mon Sep 17 00:00:00 2001 From: Nick Kezhaya Date: Tue, 19 Nov 2019 20:05:13 -0600 Subject: [PATCH 05/12] Remove unnecessary test --- test/mandrill_test.exs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test/mandrill_test.exs b/test/mandrill_test.exs index d9d4a45..4ff9d35 100644 --- a/test/mandrill_test.exs +++ b/test/mandrill_test.exs @@ -8,11 +8,4 @@ defmodule MandrillTest do test "ping returns pong" do assert Mandrill.Users.ping() == "PONG!" end - - test "process_response_body returns a map with string keys" do - assert Mandrill.process_response_body("{\"language\": \"elixir\", \"awesome\": true}") == %{ - "awesome" => true, - "language" => "elixir" - } - end end From 2b3fe4edaae5c5e3e57edcd477d81c7295ed7478 Mon Sep 17 00:00:00 2001 From: Nick Kezhaya Date: Tue, 19 Nov 2019 20:05:26 -0600 Subject: [PATCH 06/12] Move Tesla calls into nested submodule --- lib/mandrill.ex | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/lib/mandrill.ex b/lib/mandrill.ex index 34db982..5ed55ab 100644 --- a/lib/mandrill.ex +++ b/lib/mandrill.ex @@ -2,29 +2,13 @@ defmodule Mandrill do @moduledoc """ An HTTP client for Mandrill. """ - use Tesla - plug(Tesla.Middleware.BaseUrl, "https://mandrillapp.com/api/1.0/") - plug(Tesla.Middleware.JSON) + defmodule Client do + @moduledoc false + use Tesla - @doc """ - Creates the URL for our endpoint. - Args: - * endpoint - part of the API we're hitting - Returns string - """ - def process_url(endpoint) do - "https://mandrillapp.com/api/1.0/" <> endpoint <> ".json" - end - - @doc """ - Converts the binary keys in our response to strings. - Args: - * body - string binary response - Returns Record or ArgumentError - """ - def process_response_body(body) do - json_library().decode!(body) + plug Tesla.Middleware.BaseUrl, "https://mandrillapp.com/api/1.0/" + plug Tesla.Middleware.JSON end @doc """ @@ -36,7 +20,7 @@ defmodule Mandrill do """ def request(endpoint, body) do body = json_library().encode!(Map.new(body)) - post!(endpoint <> ".json", body).body + Client.post!(endpoint <> ".json", body).body end @doc """ From 5dd13b6d6a2f3afa18dd55bbb5c7cfd48e410c72 Mon Sep 17 00:00:00 2001 From: Nick Kezhaya Date: Tue, 19 Nov 2019 20:05:39 -0600 Subject: [PATCH 07/12] Add formatter for plug calls without parens --- .formatter.exs | 1 + 1 file changed, 1 insertion(+) create mode 100644 .formatter.exs diff --git a/.formatter.exs b/.formatter.exs new file mode 100644 index 0000000..36ca005 --- /dev/null +++ b/.formatter.exs @@ -0,0 +1 @@ +[locals_without_parens: [plug: :*]] From 7ec0ccb3741fc42db2d1568a75196841efbfae68 Mon Sep 17 00:00:00 2001 From: Nick Kezhaya Date: Tue, 19 Nov 2019 20:08:12 -0600 Subject: [PATCH 08/12] Updated instructions and version in README, and fixed broken links --- README.md | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 19fad5f..288c26c 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Add ``mandrill`` to your dependencies in your ``mix.exs``. ```Elixir defp deps do [... - {:mandrill, "~> 0.4"}] + {:mandrill, "~> 0.7"}] end ``` @@ -20,12 +20,6 @@ end > `:mandrill, :key`, or the `MANDRILL_KEY` environment variable. ```elixir -iex> Mandrill.start -:ok - -iex> Mandrill.key -"your_key" - iex> Mandrill.Users.info [username: "your_username", created_at: "2013-12-05 00:24:19.47554", public_id: "your_public_id", reputation: 0, hourly_quota: 25, @@ -57,13 +51,8 @@ iex> Mandrill.Users.info[:username] See [Mandrill's API docs](https://mandrillapp.com/api/docs/). -## Dependencies - -- [HTTPoison](https://github.com/edgurgel/httpoison) -- [JSEX](https://github.com/talentdeficit/jsex) - ## License -See [LICENSE](https://github.com/slogsdon/mandrill/blob/master/LICENSE) +See [LICENSE](https://github.com/slogsdon/mandrill-elixir/blob/master/LICENSE) -[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/949f7db1a2574d19a36cf9a21a760a6a "githalytics.com")](http://githalytics.com/slogsdon/mandrill) +[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/949f7db1a2574d19a36cf9a21a760a6a "githalytics.com")](http://githalytics.com/slogsdon/mandrill-elixir) From 5087317355c0057de2c14672ac7f5a2094b40ab5 Mon Sep 17 00:00:00 2001 From: Nick Kezhaya Date: Tue, 19 Nov 2019 20:11:09 -0600 Subject: [PATCH 09/12] Set minimum Elixir version to 1.4 --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index a6467c6..e38edc8 100644 --- a/mix.exs +++ b/mix.exs @@ -5,7 +5,7 @@ defmodule Mandrill.Mixfile do [ app: :mandrill, version: "0.5.0", - elixir: "~> 1.0", + elixir: "~> 1.4", build_embedded: Mix.env() == :prod, start_permanent: Mix.env() == :prod, description: description(), From 2fea3913068dc40d9670d7da27a79d801c7cd752 Mon Sep 17 00:00:00 2001 From: Nick Kezhaya Date: Tue, 19 Nov 2019 20:11:54 -0600 Subject: [PATCH 10/12] No need for a supervisor --- lib/mandrill/supervisor.ex | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 lib/mandrill/supervisor.ex diff --git a/lib/mandrill/supervisor.ex b/lib/mandrill/supervisor.ex deleted file mode 100644 index c7eee87..0000000 --- a/lib/mandrill/supervisor.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule Mandrill.Supervisor do - use Supervisor - - def start_link do - :supervisor.start_link(__MODULE__, []) - end - - def init([]) do - children = [ - # Define workers and child supervisors to be supervised - # worker(Mandrill.Worker, []) - ] - - # See http://elixir-lang.org/docs/stable/Supervisor.Behaviour.html - # for other strategies and supported options - supervise(children, strategy: :one_for_one) - end -end From 5fe74c26172eb8b0176e75263a0dff2d702ee38c Mon Sep 17 00:00:00 2001 From: Nick Kezhaya Date: Tue, 19 Nov 2019 20:19:15 -0600 Subject: [PATCH 11/12] Made ex_doc requirement optional --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index e38edc8..8744848 100644 --- a/mix.exs +++ b/mix.exs @@ -21,7 +21,7 @@ defmodule Mandrill.Mixfile do defp deps do [ {:tesla, ">= 0.0.0"}, - {:ex_doc, ">= 0.0.0"}, + {:ex_doc, ">= 0.0.0", optional: true}, {:jason, ">= 0.0.0", only: :test, optional: true}, {:hackney, ">= 0.0.0", only: :test} ] From 865388876bf856700c65a83a9a2f581c3e195842 Mon Sep 17 00:00:00 2001 From: Nick Kezhaya Date: Tue, 19 Nov 2019 20:21:40 -0600 Subject: [PATCH 12/12] Exdoc should only be in :dev --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 8744848..42bf442 100644 --- a/mix.exs +++ b/mix.exs @@ -21,7 +21,7 @@ defmodule Mandrill.Mixfile do defp deps do [ {:tesla, ">= 0.0.0"}, - {:ex_doc, ">= 0.0.0", optional: true}, + {:ex_doc, ">= 0.0.0", only: :dev}, {:jason, ">= 0.0.0", only: :test, optional: true}, {:hackney, ">= 0.0.0", only: :test} ]