API wrapper for mailigen.com .
Add this line to your application's Gemfile:
gem 'mailigen'
And then execute:
$ bundle
Or install it yourself as:
$ gem install mailigen
Create your mailigen instance and call 'call' method. First param - API method, seconds param - parameters (api_key included by default).
Few examples:
require "mailigen"
mailigen = Mailigen::Api.new YOUR_MAILIGEN_API_KEY
# Ping to check apy key
mailigen.call :ping # returns "Everything's Ok!" if API KEY is correct
# Creates a list
list_id = mailigen.call :listCreate, {title: "testListRspec", options: {permission_reminder: "Your in", notify_to: "[email protected]", subscription_notify: false}}
# Adds extra var to list
mailigen.call :listMergeVarAdd, {id: list_id, tag: "NAME", name: "Name of user"}
# Adds contacts batch to list
contacts_array_hash = {
"0" => {EMAIL: "[email protected]", EMAIL_TYPE: 'plain', NAME: 'Foo'},
"1" => {EMAIL: "[email protected]", EMAIL_TYPE: 'html', NAME: 'Bar'},
"2" => {EMAIL: "[email protected]", EMAIL_TYPE: 'html', NAME: 'Foo Dublicate'}
}
resp = mailigen.call :listBatchSubscribe, {id: list_id, batch: contacts_array_hash, double_optin: false}
puts resp["success_count"] # Output should be 3
For more: Mailigen API documentation
Gem using RSpec tests. You must add spec/keys/api.yml:
mailigen:
api_key: "YOUR_MAILIGEN_API_KEY"
- 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