UNPKG

mailosaur

Version:

The Mailosaur Node library lets you integrate email and SMS testing into your continuous integration process.

25 lines (22 loc) 922 B
const MessageAddress = require('./messageAddress'); const MessageContent = require('./messageContent'); const Attachment = require('./attachment'); const Metadata = require('./metadata'); class Message { constructor(data = {}) { this.id = data.id; this.type = data.type; this.from = (data.from || []).map((i) => (new MessageAddress(i))); this.to = (data.to || []).map((i) => (new MessageAddress(i))); this.cc = (data.cc || []).map((i) => (new MessageAddress(i))); this.bcc = (data.bcc || []).map((i) => (new MessageAddress(i))); this.received = new Date(data.received); this.subject = data.subject; this.html = new MessageContent(data.html); this.text = new MessageContent(data.text); this.attachments = (data.attachments || []).map((i) => (new Attachment(i))); this.metadata = new Metadata(data.metadata); this.server = data.server; } } module.exports = Message;