Skip to content

Commit

Permalink
Version bump 0.4.4 - setSubject, setText, setHtml
Browse files Browse the repository at this point in the history
  • Loading branch information
motdotla committed Nov 7, 2013
1 parent 8433763 commit f5bbe3c
Show file tree
Hide file tree
Showing 6 changed files with 232 additions and 3 deletions.
26 changes: 25 additions & 1 deletion README.md
Expand Up @@ -35,7 +35,7 @@ Add the following to your `package.json` file:
...
"dependencies": {
...
"sendgrid": "0.4.3"
"sendgrid": "0.4.4"
}
}
```
Expand Down Expand Up @@ -202,6 +202,30 @@ email.setFrom('foo@bar.com');
sendgrid.send(email, function(err, json) { });
```

#### setSubject

```javascript
var email = new Email();
email.setFrom('foo@bar.com');
sendgrid.send(email, function(err, json) { });
```

#### setText

```javascript
var email = new Email();
email.setText('Some text');
sendgrid.send(email, function(err, json) { });
```

#### setHtml

```javascript
var email = new Email();
email.setHtml('<h1>Some html</h1>');
sendgrid.send(email, function(err, json) { });
```

#### setHeaders

You can set custom headers.
Expand Down
12 changes: 12 additions & 0 deletions lib/email.js
Expand Up @@ -87,6 +87,18 @@ Email.prototype.setFrom = function(from) {
this.from = from;
};

Email.prototype.setSubject = function(subject) {
this.subject = subject;
};

Email.prototype.setText = function(text) {
this.text = text;
};

Email.prototype.setHtml = function(html) {
this.html = html;
};

/**
* This method is a proxy for the add sub val on the SmtpapiHeaders
*
Expand Down
171 changes: 171 additions & 0 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -9,7 +9,7 @@
],
"name": "sendgrid",
"description": "A NodeJS implementation of the SendGrid Api.",
"version": "0.4.3",
"version": "0.4.4",
"homepage": "http://sendgrid.com",
"repository": {
"type": "git",
Expand Down
22 changes: 22 additions & 0 deletions test/lib/email.test.js
Expand Up @@ -200,6 +200,28 @@ describe('Email', function () {
expect(email.from).to.eql('kyle.partridge@sendgrid.com');
});

it('should be possible to setSubject', function() {
var email = new Email();
expect(email.subject).to.be.empty;
email.setSubject('A subject');
expect(email.subject).to.eql('A subject');
});

it('should be possible to setText', function() {
var email = new Email();
expect(email.text).to.be.empty;
email.setText('Some text');
expect(email.text).to.eql('Some text');
});

it('should be possible to setHtml', function() {
var email = new Email();
expect(email.html).to.be.empty;
email.setHtml('<p>Some html</p>');
expect(email.html).to.eql('<p>Some html</p>');
});


describe('files', function() {
it('should support adding attachments via path', function() {
var email = new Email();
Expand Down
2 changes: 1 addition & 1 deletion test/lib/sendgrid.test.js
Expand Up @@ -19,7 +19,7 @@ describe('SendGrid', function () {
});

it('version should be set', function() {
expect(sendgrid.version).to.equal("0.4.3");
expect(sendgrid.version).to.equal("0.4.4");
});

it('should attach a options object to self', function() {
Expand Down

0 comments on commit f5bbe3c

Please sign in to comment.