-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclient.js
28 lines (23 loc) · 807 Bytes
/
client.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
var Hoek = require('hoek');
(function(root, factory) {
if (typeof exports === 'object' && typeof module === 'object') {
module.exports = factory(); // Export if used as a module
} else if (typeof define === 'function' && define.amd) {
define(factory);
} else if (typeof exports === 'object') {
exports.hapiSendGrid = factory();
} else {
root.hapiSendGrid = factory();
}
})(this, function() {
var Client = function(sendGridClient, defaultEmailOptions) {
this.sendGridClient = sendGridClient;
this.defaultEmailOptions = defaultEmailOptions;
};
Client.prototype.send = function(email) {
var newEmail = Hoek.applyToDefaults(email, this.defaultEmailOptions);
return this.sendGridClient.sendAsync(newEmail);
};
// expose the interface
return Client;
});