Repository is archived
No commit activity in last 3 years
No release in over 3 years
A RubyGem That wraps EmailCenter's maxemail JSON Api
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3.0
>= 0
~> 2.14.0

Runtime

~> 0.11.0
~> 1.7.5
 Project Readme

EmailCenterApi

A RubyGem That wraps EmailCenter's maxemail JSON Api

see http://maxemail.emailcenteruk.com/manual/doku.php?id=maxemail:v6:webservices

Installation

Add this line to your application's Gemfile:

gem 'email_center_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install email_center_api

Usage

General configuration

require 'email_center_api'

This will load a configuration yaml file from:

'config/email_center_api.yml'

You can set a custom configuration file with:

EmailCenterApi.config_path = 'path/to/config'

The config file should contain the keys:

base_uri
username
password

Email Node Class

The 'email' tree can be queried in the following ways:

# All children elements of a node:
EmailCenterApi::Nodes::EmailNode.all(selector)

# Folders from a node:
EmailCenterApi::Nodes::EmailNode.folders(selector)

# Emails from a node:
EmailCenterApi::Nodes::EmailNode.emails(selector)

where the selector contains an optional parameter to select the parent folder in the form:

{  folder: <folder node id> }

This will return and array of EmailCenterApi::Nodes::EmailNode object.

Email Node Instance

Each email node is a folder it can be queried in the following ways:

node = EmailCenterApi::Nodes::EmailNode.all(selector).first

# All children elements of a node:
node.all

# Folders from a node:
node.folders

# Emails from a node:
node.emails

Alternatively an email node can be triggered to send an email:

node = EmailCenterApi::Nodes::EmailNode.all(selector).first

# All children elements of a node:
node.trigger(<email_address>, <options>)

Where options is a hash containing the relevant profile data for the email. See Maxemail Documentation for more details.

Email Template Node Instance

Can be used to query all templates within the tree:

EmailCenterApi::Nodes::TemplateNode.all

This returns a array of template instances which exposes name and nodeId attributes.

Contributing

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