A lightweight and flexible Ruby SDK for Sendy, a self-hosted email newsletter app.
Add this line to your application's Gemfile:
gem 'cindy'
And then execute:
$ bundle
Or install it yourself as:
$ gem install cindy
The API of Cindy was basically implemented after Sendy's API doc.
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:
> c.subscribe 1, "foo@bar.com", "Foo Bar"
=> true
> c.unsubscribe 1, "foo@bar.com"
=> false
The parameters are:
- List ID - You can find them under list management page.
- Email - Email to subscribe or unsubscribe from the list
- Name - Optional, used only for subscribe
To check subscription status for Email address:
> c.subscription_status 3, "foo@bar.com"
=> "Unsubscribed"
The parameters are list ID and Email.
To get active subscriber count of a list:
> c.active_subscriber_count 5
=> 1660
The only required parameter here is list ID.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request