Skip to content

artursbraucs/mailigen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mailigen

Gem Version Build Status Coverage Status

API wrapper for mailigen.com .

Installation

Add this line to your application's Gemfile:

gem 'mailigen'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mailigen

Usage

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

Testing

Gem using RSpec tests. You must add spec/keys/api.yml:

mailigen:
  api_key: "YOUR_MAILIGEN_API_KEY"

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

Mailigen.com API wrapper

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages