From ce181eca0be00ecc75cc8f7a2e3931ec401c6c2b Mon Sep 17 00:00:00 2001 From: Chaitanya Surapaneni Date: Wed, 4 Mar 2015 15:52:26 -0600 Subject: [PATCH 1/2] Updating to v2 --- lib/kickbox/api/kickbox.js | 6 ++++-- lib/kickbox/http_client/index.js | 4 ++-- package.json | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/kickbox/api/kickbox.js b/lib/kickbox/api/kickbox.js index 9d2fd48..db3d17f 100644 --- a/lib/kickbox/api/kickbox.js +++ b/lib/kickbox/api/kickbox.js @@ -10,7 +10,7 @@ var Kickbox = function(client) { /** * Email Verification * - * '/verify?email=:email' GET + * '/verify?email=:email&timeout=:timeout' GET * * @param "email" Email address to verify */ @@ -20,11 +20,13 @@ Kickbox.prototype.verify = function (email, options, callback) { options = {}; } + var timeout = (options['timeout'] ? options['timeout'] : 6000); + email = encodeURIComponent(email); var body = (options['query'] ? options['query'] : {}); - this.client.get('/verify?email=' + email + '', body, options, function(err, response) { + this.client.get('/verify?email=' + email + '&timeout=' + timeout + '', body, options, function(err, response) { if (err) { return callback(err); } diff --git a/lib/kickbox/http_client/index.js b/lib/kickbox/http_client/index.js index ded5a6e..699bf35 100644 --- a/lib/kickbox/http_client/index.js +++ b/lib/kickbox/http_client/index.js @@ -30,8 +30,8 @@ client.HttpClient = function (auth, options) { this.options = { 'base': 'https://api.kickbox.io', - 'api_version': 'v1', - 'user_agent': 'alpaca/0.2.1 (https://github.com/pksunkara/alpaca)' + 'api_version': 'v2', + 'user_agent': 'kickbox-node/2.0.0 (https://github.com/kickboxio/kickbox-node)' }; for (var key in options) { diff --git a/package.json b/package.json index 5d7f6e7..65c0f8a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kickbox", - "version": "1.0.4", + "version": "2.0.0", "description": "Official kickbox API library client for node.js", "author": "Chaitanya Surapaneni (https://github.com/kickboxio)", "homepage": "http://kickbox.io", From 1ce65c99a7e3aac701c86aff99b658ff4e3c4c35 Mon Sep 17 00:00:00 2001 From: Daniel Stevens Date: Mon, 16 Mar 2015 11:35:12 -0500 Subject: [PATCH 2/2] Added timeout docs --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index fc17370..7c01fd9 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,16 @@ kickbox.verify("test@example.com", function (err, response) { console.log(response.body); }); ``` + +#### Options + +**timeout** `integer` (optional) - Maximum time, in milliseconds, for the API to complete a verification request. Default: 6000. + +```js +// Example with options +kickbox.verify("test@example.com", {timeout: 6000}, function (err, response) {/*...*/}); +``` + ### Response information A successful API call responds with the following values: