rdstation-clj-client
Wrapper for RDStation API
Install
- Leiningen/Boot
[rdstation-clj-client "0.1.0-SNAPSHOT"]
- Gradle
compile "rdstation-clj-client:rdstation-clj-client:0.1.0-SNAPSHOT"
- Maven
<dependency>
<groupId>rdstation-clj-client</groupId>
<artifactId>rdstation-clj-client</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>
Usage
First things first! Go to your RDStation account and get your tokens.
The credencials
function can receive two arguemnts rdstation-token
andtoken-token
.
However, is not recommended hard coded sensitive data into your code. So, this function also can be
invoked whitout any arguments, in this case, tokens should be stored in environment variables, as:
RDSTATION_TOKEN
and AUTH_TOKEN
.
Create a Lead
(def basic-lead {:email "rasputin@russia.ru" :name "Grigori Yefimovich Rasputin"})
(add-lead basic-lead (credencials) :identifier "clojure")
Update a Lead
(update-lead "edipofederle@gmail.com" {:website "foo.com.br"} (credencials))
The RDStation API accepts a Lead only with e-mail. However, here we require e-mail and name. That is validated using a Schema called LeadData. For example:
Experiments with Schema lib (very early stage)
(s/validate
LeadData
{:name "Jhon" :email "jhon@gmail.com"})
Value does not match schema: {:nome missing-required-key, :name disallowed-key}
{:type :schema.core/error, :schema {:email java.lang.String, :nome java.lang.String}, :value {:name "Jhon", :email "jhon@gmail.com"}, :error {:nome missing-required-key, :name disallowed-key}}
License
Copyright © 2017 FIXME
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.