Comparing version 0.2.1 to 0.2.2
21
index.js
@@ -12,7 +12,19 @@ var request = require('request'); | ||
Authy.prototype.register_user = function (email, cellphone, country_code, callback) { | ||
Authy.prototype.register_user = function (email, cellphone, country_code, send_sms_install_link, callback) { | ||
var country = "1"; | ||
if (arguments.length > 3) { | ||
var send_install_link = true; | ||
if (arguments.length > 4) { | ||
country = country_code; | ||
} else { | ||
send_install_link = send_sms_install_link; | ||
} | ||
else if (arguments.length == 4) { | ||
callback = send_sms_install_link; | ||
if (typeof country_code == "boolean") { | ||
send_install_link = country_code; | ||
} | ||
else { | ||
country = country_code; | ||
} | ||
} | ||
else { | ||
callback = country_code; | ||
@@ -29,3 +41,4 @@ } | ||
qs: { | ||
api_key: this.apiKey | ||
api_key: this.apiKey, | ||
send_install_link_via_sms: send_install_link | ||
}, | ||
@@ -32,0 +45,0 @@ json: true, |
{ | ||
"name": "authy", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Authy.com API lib for node.js", | ||
@@ -27,3 +27,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"request": "2.33.0" | ||
"request": "2.39.0" | ||
}, | ||
@@ -30,0 +30,0 @@ "devDependencies": { |
@@ -35,4 +35,5 @@ # node-authy [![Dependency Status](https://david-dm.org/evilpacket/node-authy.png)](https://david-dm.org/evilpacket/node-authy) | ||
register_user(email, cellphone, [country_code], callback); | ||
register_user(email, cellphone, [country_code], [send_install_link_via_sms], callback); | ||
```javascript | ||
@@ -44,2 +45,4 @@ authy.register_user('baldwin@andyet.net', '509-555-1212', function (err, res) { | ||
If not given, `country_code` defaults to `"1"` and `send_install_link_via_sms` defaults to `true`. | ||
Verify Token | ||
@@ -46,0 +49,0 @@ ------------ |
@@ -16,3 +16,3 @@ var apikey = "0cd08abec2e9b9641e40e9470a7fc336"; | ||
*/ | ||
exports['Register New User - Without country code'] = function (test) { | ||
exports['Register New User - Without country code or SMS install link param'] = function (test) { | ||
authy.register_user(test_user.email, test_user.phone, function (err, res) { | ||
@@ -27,3 +27,3 @@ test.ok(res); | ||
exports['Register New User - With country code'] = function (test) { | ||
exports['Register New User - With country code but no SMS install link param'] = function (test) { | ||
authy.register_user(test_user.email, test_user.phone, test_user.country, function (err, res) { | ||
@@ -36,2 +36,18 @@ test.ok(res); | ||
exports['Register New User - With country code and SMS install link param'] = function (test) { | ||
authy.register_user(test_user.email, test_user.phone, test_user.country, false, function (err, res) { | ||
test.ok(res); | ||
test.equal(typeof(res), 'object', 'Response should be an object.'); | ||
test.done(); | ||
}); | ||
}; | ||
exports['Register New User - With SMS install link param but no country code'] = function (test) { | ||
authy.register_user(test_user.email, test_user.phone, false, function (err, res) { | ||
test.ok(res); | ||
test.equal(typeof(res), 'object', 'Response should be an object.'); | ||
test.done(); | ||
}); | ||
}; | ||
exports['Register New User - Blank Email'] = function (test) { | ||
@@ -38,0 +54,0 @@ authy.register_user(null, test_user.phone, test_user.country, function (err, res) { |
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
11667
268
94
+ Addedhawk@1.1.1(transitive)
+ Addedmime-types@1.0.2(transitive)
+ Addedrequest@2.39.0(transitive)
+ Addedstringstream@0.0.6(transitive)
+ Addedtunnel-agent@0.4.3(transitive)
- Removedhawk@1.0.0(transitive)
- Removedrequest@2.33.0(transitive)
- Removedtunnel-agent@0.3.0(transitive)
Updatedrequest@2.39.0