Comparing version 0.0.5 to 0.1.0
39
index.js
@@ -40,3 +40,3 @@ var request = require('request'); | ||
} else { | ||
throw new Error(err); | ||
callback(err); | ||
} | ||
@@ -62,3 +62,3 @@ }); | ||
} else { | ||
throw new Error(err); | ||
callback(err); | ||
} | ||
@@ -92,3 +92,3 @@ }); | ||
} else { | ||
throw new Error(err); | ||
callback(err); | ||
} | ||
@@ -122,3 +122,3 @@ }); | ||
} else { | ||
throw new Error(err); | ||
callback(err); | ||
} | ||
@@ -128,3 +128,32 @@ }); | ||
// Utility functions. Should live somebody else probably. | ||
Authy.prototype.request_call = function (id, force, callback) { | ||
var qs = { | ||
api_key: this.apiKey | ||
}; | ||
if (arguments.length > 2) { | ||
qs.force = force; | ||
} else { | ||
callback = force; | ||
} | ||
request.get({ | ||
url: this.apiURL + "/protected/json/call/" + id, | ||
qs: qs, | ||
jar: false, | ||
strictSSL: true | ||
}, function (err, res, body) { | ||
if (!err) { | ||
if (res.statusCode === 200) { | ||
callback(null, toJSON(body)); | ||
} else { | ||
callback(body); | ||
} | ||
} else { | ||
callback(err); | ||
} | ||
}); | ||
}; | ||
// Utility functions. Should live somewhere else probably. | ||
function isJSON(data) { | ||
@@ -131,0 +160,0 @@ if (typeof data === 'object') return true; |
{ | ||
"name": "authy", | ||
"version": "0.0.5", | ||
"version": "0.1.0", | ||
"description": "Authy.com API lib for node.js", | ||
@@ -27,4 +27,7 @@ "main": "index.js", | ||
"dependencies": { | ||
"request": "~2.21.0" | ||
"request": "2.33.0" | ||
}, | ||
"devDependencies": { | ||
"nodeunit": "*" | ||
} | ||
} |
@@ -1,3 +0,2 @@ | ||
node-authy | ||
========== | ||
# node-authy [![Dependency Status](https://david-dm.org/evilpacket/node-authy.png)](https://david-dm.org/evilpacket/node-authy) | ||
@@ -66,2 +65,13 @@ [Authy](https://authy.com/) API Client for node.js | ||
Request Call (Email support@authy.com to enable this feature) | ||
------------------------------------------------------------- | ||
request_call(id, [force], callback); | ||
```javascript | ||
authy.request_call('1337', function (err, res) { | ||
}); | ||
``` | ||
Delete Registered User | ||
@@ -68,0 +78,0 @@ ---------------------- |
@@ -64,1 +64,18 @@ var apikey = "0cd08abec2e9b9641e40e9470a7fc336"; | ||
/* | ||
* Request Call Tests | ||
*/ | ||
exports['Request Call'] = function (test) { | ||
authy.request_call(test_user.id, function (err, res) { | ||
test.ok(res); | ||
test.done(); | ||
}); | ||
}; | ||
exports['Request Call - Force'] = function (test) { | ||
authy.request_call(test_user.id, true, function (err, res) { | ||
test.ok(res); | ||
test.done(); | ||
}); | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9316
224
91
1
+ Addedassert-plus@0.1.5(transitive)
+ Addedasync@0.9.2(transitive)
+ Addedaws-sign2@0.5.0(transitive)
+ Addedctype@0.5.3(transitive)
+ Addedform-data@0.1.4(transitive)
+ Addedhawk@1.0.0(transitive)
+ Addedhttp-signature@0.10.1(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedrequest@2.33.0(transitive)
+ Addedtldts@6.1.67(transitive)
+ Addedtldts-core@6.1.67(transitive)
+ Addedtough-cookie@5.0.0(transitive)
- Removedassert-plus@0.1.2(transitive)
- Removedasync@0.2.10(transitive)
- Removedaws-sign@0.3.0(transitive)
- Removedcookie-jar@0.3.0(transitive)
- Removedctype@0.5.2(transitive)
- Removedform-data@0.0.8(transitive)
- Removedhawk@0.13.1(transitive)
- Removedhoek@0.8.5(transitive)
- Removedhttp-signature@0.9.11(transitive)
- Removedjson-stringify-safe@4.0.0(transitive)
- Removedrequest@2.21.0(transitive)
Updatedrequest@2.33.0