A lightweight and flexible Ruby SDK for Sendy, a self-hosted email newsletter app.
The API of Cindy was basically implemented after Sendy's API documentation.
To use Cindy, first create a client instance:
c = Cindy.new "http://sendy.co/demo/", "QywLZqDddP2P//d6ntekf+GY82nLrHke"
There're two parameters for initialize method:
- API Endpoint - The URL for Sendy installation.
- API Key - Optional, only for subscription status methods.
Then you can subscribe or unsubscribe from a list:
- Note: list_id and email are required fields for both methods, while the subscribe method takes an optional name value and custom fields hash
> c.subscribe list_id, "foo@bar.com", "My Name", {company: "My Company", members: 3}
=> true
> c.subscribe list_id, "foo@bar.com", nil, {company: "My Company", members: 3}
=> true
> c.subscribe list_id, "foo@bar.com"
=> true
> c.unsubscribe list_id, "foo@bar.com"
=> false
To check subscription status for Email address:
> c.subscription_status list_id, "foo@bar.com"
=> "Unsubscribed"
To get active subscriber count of a list:
> c.active_subscriber_count list_id
=> 1660
To create new campaign:
> c.create_campaign from_name: "foo", from_email: "foo@bar.com", reply_to: "foo@bar.com", subject: "Hello, world", html_text: "<h1>Hello, world</h1>"
=> Campaign created
Check Sendy's API documentation to learn more about parameters and possible responses.
MIT License. Copyright 2013-2015 Polydice, Inc. http://polydice.com/