emailable
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -27,6 +27,10 @@ 'use strict'; | ||
.catch(error => { | ||
reject({ | ||
message: error.response?.data?.message, | ||
code: error.response?.status | ||
}) | ||
if (error.response) { | ||
reject({ | ||
message: error.response.data.message, | ||
code: error.response.status | ||
}) | ||
} else { | ||
reject({ message: error }); | ||
} | ||
}); | ||
@@ -33,0 +37,0 @@ |
{ | ||
"name": "emailable", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Email Verification that's astonishingly easy and low-cost. See https://emailable.com for details.", | ||
@@ -5,0 +5,0 @@ "main": "lib/emailable.js", |
@@ -27,3 +27,5 @@ # Emailable Node Library | ||
The library needs to be configured with your account's API key which is available in your [Emailable Dashboard](https://app.emailable.com/api). Require it with your API key: | ||
The library needs to be configured with your account's API key which is | ||
available in your [Emailable Dashboard](https://app.emailable.com/api). Require | ||
it with your API key: | ||
@@ -33,4 +35,8 @@ ### Setup | ||
```javascript | ||
// require with api key | ||
// require with API key | ||
var emailable = require('emailable')('live_...') | ||
// ES6 import | ||
import Emailable from 'emailable'; | ||
const emailable = Emailable('live_...'); | ||
``` | ||
@@ -51,2 +57,18 @@ | ||
#### Additional options | ||
You can also pass any of the additional | ||
[options](https://emailable.com/docs/api?javascript#verify-an-email) | ||
as a second parameter to `verify`. | ||
```javascript | ||
emailable.verify('jarrett@emailable.com', { timeout: 10 }) | ||
.then(function (response) { | ||
console.log(response); | ||
}) | ||
.catch(function (error) { | ||
console.log(error); | ||
}); | ||
``` | ||
#### Slow Email Server Handling | ||
@@ -63,3 +85,3 @@ | ||
{ | ||
message: 'Your request is taking longer than normal. Please send your request again.' | ||
message: 'Your request is taking longer than normal. Please send your request again.' | ||
} | ||
@@ -78,8 +100,15 @@ ``` | ||
}); | ||
``` | ||
// you can optionally pass in options like a callback url that we'll POST to when the | ||
// batch is complete. | ||
emailable.batches.verify(emails, { url: 'https://emailable.com/' }).then(function (response) { | ||
console.log(response.id); | ||
}); | ||
##### Additional options | ||
You can also pass any of the additional | ||
[options](https://emailable.com/docs/api?javascript#verify-a-batch-of-emails) | ||
as a second parameter to `verify`. | ||
```javascript | ||
emailable.batches.verify(emails, { url: 'https://emailable.com/' }). | ||
then(function (response) { | ||
console.log(response.id); | ||
}); | ||
``` | ||
@@ -109,3 +138,4 @@ | ||
If you do not have `yarn` installed, you can get it with `npm install --global yarn`. | ||
If you do not have `yarn` installed, you can get it with `npm install --global | ||
yarn`. | ||
@@ -120,2 +150,3 @@ Run a single test suite without a coverage report: | ||
Bug reports and pull requests are welcome on GitHub at https://github.com/emailable/emailable-node. | ||
Bug reports and pull requests are welcome on GitHub at | ||
https://github.com/emailable/emailable-node. |
11528
176
146