lib/index.js
function send(payload, promise) {
	if (typeof apostle.domainKey == 'undefined'){
		promise.reject('invalid', [{error: 'No domain key defined. Please set a domain key with `apostle.domainKey = "abc123"`'}])
		return;
	}
	(request || superagent)
		.post(apostle.deliveryEndpoint)
		.type('json')
		.send(payload)
		.set('Authorization', 'Bearer ' + apostle.domainKey)
		.set('Apostle-Client', 'JavaScript/v0.1.1')
		.end(function(err, res){
			if(res.ok){
				promise.fulfill()
			}else{
				promise.reject('error', res)
			}
		})
}
function send(payload, promise) {
	if (typeof apostle.domainKey == 'undefined'){
		promise.reject('invalid', [{error: 'No domain key defined. Please set a domain key with `apostle.domainKey = "abc123"`'}])
		return;
	}
	(request || superagent)
		.post(apostle.deliveryEndpoint)
		.type('json')
		.send(payload)
		.set('Authorization', 'Bearer ' + apostle.domainKey)
		.set('Apostle-Client', 'JavaScript/v0.1.1')
		.end(function(err, res){
			if(res.ok){
				promise.fulfill()
			}else{
				promise.reject('error', res)
			}
		})
}
function send ( payload , promise ) { if ( typeof apostle . domainKey == 'undefined' ) { promise . reject ( 'invalid' , [ { error : 'No domain key defined. Please set a domain key with `apostle.domainKey = "abc123"`' } ] ) return ; } ( request || superagent ) . post ( apostle . deliveryEndpoint ) . type ( 'json' ) . send ( payload ) . set ( 'Authorization' , 'Bearer ' + apostle . domainKey ) . set ( 'Apostle-Client' , 'JavaScript/v0.1.1' ) . end ( function ( err , res ) { if ( res . ok ) { promise . fulfill ( ) } else { promise . reject ( 'error' , res ) } } ) }
Delivery the JSON payload to the delivery endpoint via Request.

@param {object} Recipient Payload
- recipients {object} Email => data object of recipient information
@param {promise} Deferred promise object

@return {null}
Delivery the JSON payload to the delivery endpoint via Request .