mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-28 16:15:49 +00:00
[CHORE] BlobClient exported by name
This commit is contained in:
@@ -3,6 +3,8 @@ var request = require('superagent');
|
|||||||
var async = require('async');
|
var async = require('async');
|
||||||
var extend = require("extend");
|
var extend = require("extend");
|
||||||
|
|
||||||
|
var BlobClient = {};
|
||||||
|
|
||||||
//Blob object class
|
//Blob object class
|
||||||
var BlobObj = function (url, id, key) {
|
var BlobObj = function (url, id, key) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
@@ -746,7 +748,7 @@ Identity.prototype.unset = function (pointer, key, fn) {
|
|||||||
/**
|
/**
|
||||||
* Blob object class
|
* Blob object class
|
||||||
*/
|
*/
|
||||||
module.exports.Blob = BlobObj
|
BlobClient.Blob = BlobObj
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ripple name for a given address
|
* Get ripple name for a given address
|
||||||
@@ -766,7 +768,7 @@ module.exports.getRippleName = function (url, address, fn) {
|
|||||||
/*
|
/*
|
||||||
* Retrive a blob with url, id and key
|
* Retrive a blob with url, id and key
|
||||||
*/
|
*/
|
||||||
module.exports.get = function (url, id, crypt, fn) {
|
BlobClient.get = function (url, id, crypt, fn) {
|
||||||
var blob = new BlobObj(url, id, crypt);
|
var blob = new BlobObj(url, id, crypt);
|
||||||
blob.init(fn);
|
blob.init(fn);
|
||||||
}
|
}
|
||||||
@@ -775,7 +777,7 @@ module.exports.get = function (url, id, crypt, fn) {
|
|||||||
/*
|
/*
|
||||||
* Verify email address
|
* Verify email address
|
||||||
*/
|
*/
|
||||||
module.exports.verify = function (url, username, token, fn) {
|
BlobClient.verify = function (url, username, token, fn) {
|
||||||
url += '/v1/user/' + username + '/verify/' + token;
|
url += '/v1/user/' + username + '/verify/' + token;
|
||||||
request.get(url, function(err, resp){
|
request.get(url, function(err, resp){
|
||||||
if (err) return fn(err);
|
if (err) return fn(err);
|
||||||
@@ -798,7 +800,7 @@ module.exports.verify = function (url, username, token, fn) {
|
|||||||
* @param {object} options.oldUserBlob
|
* @param {object} options.oldUserBlob
|
||||||
* @param {function} fn
|
* @param {function} fn
|
||||||
*/
|
*/
|
||||||
module.exports.create = function (options, fn) {
|
BlobClient.create = function (options, fn) {
|
||||||
|
|
||||||
var blob = new BlobObj(options.url, options.id, options.crypt);
|
var blob = new BlobObj(options.url, options.id, options.crypt);
|
||||||
|
|
||||||
@@ -844,4 +846,6 @@ module.exports.create = function (options, fn) {
|
|||||||
else if (resp.body && resp.body.result === 'success') return fn(null, blob,resp.body);
|
else if (resp.body && resp.body.result === 'success') return fn(null, blob,resp.body);
|
||||||
else return fn(new Error("Could not create blob"));
|
else return fn(new Error("Could not create blob"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports.BlobClient = BlobClient;
|
||||||
Reference in New Issue
Block a user