From 052211e0af39f4144c78d8efadc8987be2976d92 Mon Sep 17 00:00:00 2001 From: Joshua Rieken Date: Tue, 29 Sep 2015 16:36:27 -0700 Subject: Add add_pending_member function --- lib/list.ex | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/list.ex') diff --git a/lib/list.ex b/lib/list.ex index 43ec63a..8589eb2 100644 --- a/lib/list.ex +++ b/lib/list.ex @@ -21,6 +21,13 @@ defmodule Mailchimp.List do |> post(body, map_header) end + def add_pending_member(config, %{"list_id" => list_id, "email" => email}) do + map_header = %{"Authorization" => "apikey #{config.apikey}"} + {:ok, body} = Poison.encode(%{email_address: email, status: "pending"}) + config.apiroot <> "lists/" <> list_id <> "/members" + |> post(body, map_header) + end + def build_url(root) do params = [ {:fields, ["lists.id", "lists.name", "lists.stats.member_count"]}, -- cgit v1.2.1