firebase-admin
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -47,2 +47,3 @@ | ||
this.ready = deferred.promise; | ||
} | ||
@@ -181,2 +182,30 @@ | ||
/** | ||
* Promises to create a new Firebase instance under the account | ||
* with the specified username and password. A convenience method. | ||
* @param {String} email The email address associated with the account. | ||
* @param {String} password The password for the account. | ||
* @returns {external:Promise} A promise that resolves with a | ||
* {@link FirebaseInstance} if successful and rejects with an Error if | ||
* there's an error. | ||
* @example | ||
* FirebaseAccount.bootstrapInstance('me@foo.com', 'foobar') | ||
* .then(function(db) { | ||
* // get a Firebase reference to the new instance | ||
* var fb = new Firebase(db.toString()); | ||
* fb.child('spam/spam/spam/spam').set('wonderful'); | ||
* }, function(err) { | ||
* console.error('Error while creating new instance:', err); | ||
* }); | ||
*/ | ||
FirebaseAccount.bootstrapInstance = function(email, password) { | ||
return new FirebaseAccount(email, password).ready.then(function(acct) { | ||
return acct.createDatabase(Math.random().toString(36).slice(2)); | ||
}); | ||
}; | ||
module.exports = FirebaseAccount; |
{ | ||
"name": "firebase-admin", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Programmatically instantiate and modify Firebase instances.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -108,3 +108,13 @@ | ||
describe('bootstrapInstance', function() { | ||
it('promises to create a new database with a random name immediately', function() { | ||
return (expect( FirebaseAccount.bootstrapInstance(fbUser, fbPass) )).to.be.fulfilled; | ||
}); | ||
}); | ||
}); | ||
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
25574
629