emailable
Advanced tools
Comparing version 2.0.0 to 3.0.0
@@ -9,10 +9,12 @@ 'use strict'; | ||
verify(emails, callbackURL) { | ||
verify(emails, options = {}) { | ||
return this.client.makePostRequest( | ||
'post', 'batch', { emails: emails.join(','), url: callbackURL } | ||
'post', 'batch', Object.assign({}, { emails: emails.join(',') }, options) | ||
); | ||
} | ||
status(id) { | ||
return this.client.makeRequest('get', 'batch', { id: id }); | ||
status(id, options = {}) { | ||
return this.client.makeRequest( | ||
'get', 'batch', Object.assign({}, { id: id }, options) | ||
); | ||
} | ||
@@ -19,0 +21,0 @@ |
{ | ||
"name": "emailable", | ||
"version": "2.0.0", | ||
"description": "Email Verification that’s astonishingly easy and low-cost. See https://emailable.com for details.", | ||
"version": "3.0.0", | ||
"description": "Email Verification that's astonishingly easy and low-cost. See https://emailable.com for details.", | ||
"main": "lib/emailable.js", | ||
@@ -31,8 +31,8 @@ "scripts": { | ||
"chai": "^4.2.0", | ||
"mocha": "^7.1.1" | ||
"mocha": "^9.2.0" | ||
}, | ||
"dependencies": { | ||
"@types/node": "^13.9.5", | ||
"axios": "^0.21.1" | ||
"axios": "^0.25.0" | ||
} | ||
} |
# Emailable Node Library | ||
[![Version](https://img.shields.io/npm/v/emailable.svg)](https://www.npmjs.org/package/emailable) | ||
[![Build Status](https://travis-ci.com/emailable/emailable-node.svg)](https://travis-ci.com/emailable/emailable-node) | ||
[![Maintainability](https://api.codeclimate.com/v1/badges/2d74c69a9155109058a7/maintainability)](https://codeclimate.com/github/emailable/emailable-node/maintainability) | ||
[![Build Status](https://app.travis-ci.com/emailable/emailable-node.svg?branch=master)](https://app.travis-ci.com/github/emailable/emailable-node) | ||
[![Maintainability](https://api.codeclimate.com/v1/badges/e1f07e3080d7ed2ca09e/maintainability)](https://codeclimate.com/github/emailable/emailable-node/maintainability) | ||
[![Downloads](https://img.shields.io/npm/dm/emailable.svg)](https://www.npmjs.com/package/emailable) | ||
@@ -75,5 +75,5 @@ [![Try on RunKit](https://badge.runkitcdn.com/emailable.svg)](https://runkit.com/npm/emailable) | ||
// you can optionally pass in a callback url that we'll POST to when the | ||
// you can optionally pass in options like a callback url that we'll POST to when the | ||
// batch is complete. | ||
emailable.batches.verify(emails, 'https://emailable.com/'}).then(function (response) { | ||
emailable.batches.verify(emails, { url: 'https://emailable.com/' }).then(function (response) { | ||
console.log(response.id); | ||
@@ -80,0 +80,0 @@ }); |
@@ -8,17 +8,17 @@ 'use strict'; | ||
it('should return account information', done => { | ||
emailable.account().then(response => { | ||
expect(response.owner_email).to.not.be.a('null'); | ||
expect(response.available_credits).to.not.be.a('null'); | ||
done(); | ||
}); | ||
}); | ||
it('should return account information', done => { | ||
emailable.account().then(response => { | ||
expect(response.owner_email).to.be.a('string'); | ||
expect(response.available_credits).to.be.a('number'); | ||
done(); | ||
}); | ||
}); | ||
it('should return a 401 status code when an invalid API key', done => { | ||
require('../lib/emailable')().account().catch(error => { | ||
expect(error.code).to.be.equal(401); | ||
done(); | ||
}); | ||
}); | ||
it('should return a 401 status code when an invalid API key', done => { | ||
require('../lib/emailable')().account().catch(error => { | ||
expect(error.code).to.be.equal(401); | ||
done(); | ||
}); | ||
}); | ||
}); |
@@ -16,2 +16,9 @@ 'use strict'; | ||
it('should return a payment error when passed { simulate: "payment_error" }', done => { | ||
emailable.batches.verify(emails, { simulate: 'payment_error' }).catch(error => { | ||
expect(error.code).to.be.equal(402) | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -24,6 +31,6 @@ | ||
emailable.batches.status(response.id).then(response => { | ||
expect(response.emails).to.not.be.a('null'); | ||
expect(response.total_counts).to.not.be.a('null'); | ||
expect(response.reason_counts).to.not.be.a('null'); | ||
expect(response.message).to.not.be.a('null'); | ||
expect(response.emails).to.be.an('array'); | ||
expect(response.total_counts).to.be.a('object'); | ||
expect(response.reason_counts).to.be.a('object'); | ||
expect(response.message).to.be.a('string'); | ||
done(); | ||
@@ -34,2 +41,13 @@ }); | ||
it('should return verifying response when passed { simulate: "verifying" }', done => { | ||
emailable.batches.verify(emails).then(response => { | ||
emailable.batches.status(response.id, { simulate: 'verifying' }).then(response => { | ||
expect(response.processed).to.be.a('number'); | ||
expect(response.total).to.be.a('number'); | ||
expect(response.message).to.be.a('string'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
@@ -10,9 +10,9 @@ 'use strict'; | ||
emailable.verify('deliverable@example.com').then(response => { | ||
expect(response.domain).to.not.be.a('null'); | ||
expect(response.email).to.not.be.a('null'); | ||
expect(response.reason).to.not.be.a('null'); | ||
expect(response.score).to.not.be.a('null'); | ||
expect(response.state).to.not.be.a('null'); | ||
expect(response.user).to.not.be.a('null'); | ||
expect(response.duration).to.not.be.a('null'); | ||
expect(response.domain).to.be.a('string'); | ||
expect(response.email).to.be.a('string'); | ||
expect(response.reason).to.be.a('string'); | ||
expect(response.score).to.be.a('number');; | ||
expect(response.state).to.be.a('string'); | ||
expect(response.user).to.be.a('string'); | ||
expect(response.duration).to.be.a('number'); | ||
done(); | ||
@@ -19,0 +19,0 @@ }); |
10833
172
+ Addedaxios@0.25.0(transitive)
- Removedaxios@0.21.4(transitive)
Updatedaxios@^0.25.0