Skip to content

Commit

Permalink
Merge pull request #1 from kickboxio/v2
Browse files Browse the repository at this point in the history
Updating to V2
  • Loading branch information
schaitanya committed Mar 16, 2015
2 parents 07b8392 + 1ce65c9 commit abfd39b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ kickbox.verify("[email protected]", 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("[email protected]", {timeout: 6000}, function (err, response) {/*...*/});
```

### Response information

A successful API call responds with the following values:
Expand Down
6 changes: 4 additions & 2 deletions lib/kickbox/api/kickbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/kickbox/http_client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]> (https://github.com/kickboxio)",
"homepage": "http://kickbox.io",
Expand Down

0 comments on commit abfd39b

Please sign in to comment.