Installation

The artifacts of this project are uploaded in Maven Central.

As from the sbt documentation the DefaultMavenRepository is the main Maven repository at https://repo1.maven.org/maven2/ and is included by default. Therefore you don’t need to add any resolvers to your build definition; you can simply add the scamandrill client in your build definition libraryDependencies as follow:

"io.github.scamandrill" %% "scamandrill" % "1.2.1"

All versions for this plugin can be found here. In case you are confused about the difference between build.sbt and Build.scala read this.

Configuration

All the requests that you can make to Mandrill API require that you provide your api key. In fact, consider the following snippet of code with the bare minimum instructions to make a request to madrill api:

import com.joypeg.scamandrill.client.MandrillAsyncClient
...
MandrillAsyncClient.usersPing(MKey(key = "THEKEY"))

So you need to replace ‘THEKEY’ with your own api key. But because you usually always use the same key in your application, you can simply write the previous intruction as : MandrillAsyncClient.usersPing(MKey()) . Scamandrill in this case uses the default key in the configuration. The configuration uses the conventions of typesafe config and should specify the key and the default timeout for the blocking client (discussed later). So an example of application.conf should look like:

Mandrill {
    key="MANDRILLKEY",
    timoutInSeconds=5
}

If you look at the output of the tests for users calls for example you will see that if you will get an error message from mandrill if the key is not passed to method, or if a configuration file is not defined. Btw I choose this approach to alllow the user to override the default key for each call (specifying it when building your request object). Note that the same is valid for all calls:

Calls and usage

Example

Benchmarks