SparkPost / elixir-sparkpost

SparkPost client library for Elixir https://developers.sparkpost.com
Apache License 2.0
44 stars 14 forks source link

Comments for initial review #6

Closed richleland closed 8 years ago

richleland commented 8 years ago

The example for sending using the API doesn't work as-is. Specifically:

defmodule MyApp.Example do
  alias SparkPost.Transmission
  alias SparkPost.Recipient
  alias SparkPost.Template

  def send_message do
    Transmission.create(%Transmission{
        recipients: [ %Recipient{ address: %Sparkpost.Address{ email: "your@example.com" }} ],
        return_path: "elixir@sparkpostbox.com",
        content: %Template.Inline{
          subject: "Sending email from Elixir is awesome!",
          from: %Sparkpost.Address{ email: "elixir@sparkpostbox.com" },
          text: "Hi there!",
          html: "<p>Hi there!</p>"
        }
    })
  end
end

We should also use the new Elixir 1.2 syntax for aliases to change this:

alias SparkPost.Transmission
alias SparkPost.Recipient
alias SparkPost.Template

To this:

alias SparkPost.{Transmission, Recipient, Template}

A few other things: