filefog-google
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -67,6 +67,6 @@ var q = require('q') | ||
* @method createFile | ||
* @param {} fileName | ||
* @param {} parentIdentifier | ||
* @param {} content_buffer | ||
* @param {} options | ||
* @param {String} fileName | ||
* @param {String} parentIdentifier | ||
* @param {Object} content_buffer | ||
* @param {Object} options | ||
* @return CallExpression | ||
@@ -92,7 +92,4 @@ */ | ||
options.resource.parents.push({"kind": "drive#fileLink","id":parentIdentifier}) | ||
console.log("CREATE WITH PARENT", parentIdentifier) | ||
} | ||
console.log("OPTIONS", options); | ||
var deferred = q.defer(); | ||
@@ -102,4 +99,34 @@ client.files | ||
if (err) return deferred.reject(err); | ||
console.log("================================CREATE FILE", result); | ||
return deferred.resolve(result); | ||
}); | ||
return deferred.promise; | ||
}) | ||
}; | ||
/** | ||
* Description | ||
* @method updateFile | ||
* @param {String} identifier | ||
* @param {Buffer} content_buffer | ||
* @param {Object} options | ||
* @return CallExpression | ||
*/ | ||
Client.prototype.updateFile = function (identifier, content_buffer, options) { | ||
var self = this; | ||
return self._getClient().then(function (client) { | ||
options = extend({ | ||
fileId: identifier, | ||
auth: self._oauth2Client, | ||
media: { | ||
mimeType: 'application/binary', | ||
body: content_buffer | ||
} | ||
}, options || {}); | ||
var deferred = q.defer(); | ||
client.files | ||
.update(options,function (err, result) { | ||
if (err) return deferred.reject(err); | ||
return deferred.resolve(result); | ||
@@ -114,3 +141,3 @@ }); | ||
* @method deleteFile | ||
* @param {} identifier | ||
* @param {String} identifier | ||
* @return CallExpression | ||
@@ -135,3 +162,3 @@ */ | ||
* @method downloadFile | ||
* @param {} identifier | ||
* @param {String} identifier | ||
* @return CallExpression | ||
@@ -163,3 +190,3 @@ */ | ||
* @method getFileInformation | ||
* @param {} identifier | ||
* @param {String} identifier | ||
* @return CallExpression | ||
@@ -185,2 +212,40 @@ */ | ||
* Description | ||
* @method updateFileInformation | ||
* @param {String} identifier | ||
* @param {String} fileName | ||
* @param {String} parentIdentifier | ||
* @param {Object} options | ||
* @return CallExpression | ||
*/ | ||
Client.prototype.updateFileInformation = function (identifier, fileName, parentIdentifier, options) { | ||
var self = this; | ||
identifier = identifier ||'root'; | ||
return self._getClient().then(function (client) { | ||
options = extend({ | ||
fileId: identifier, | ||
auth: self._oauth2Client, | ||
resource: {} | ||
}, options || {}); | ||
if(fileName && !options.resource.title){ | ||
options.resource.title = fileName; | ||
} | ||
if(parentIdentifier && !options.resource.parents){ | ||
options.resource.parents = []; | ||
options.resource.parents.push({"kind": "drive#fileLink","id":parentIdentifier}) | ||
} | ||
var deferred = q.defer(); | ||
client.files | ||
.patch(options, function (err, result) { | ||
if (err) return deferred.reject(err); | ||
return deferred.resolve(result); | ||
}); | ||
return deferred.promise; | ||
}) | ||
}; | ||
/** | ||
* Description | ||
* @method createFolder | ||
@@ -214,3 +279,2 @@ * @param {} folderName | ||
.insert(options, function (err, result) { | ||
console.log("================================CREATE FOLDER", result); | ||
if (err) return deferred.reject(err); | ||
@@ -217,0 +281,0 @@ return deferred.resolve(result); |
@@ -195,2 +195,4 @@ var transform = {}; | ||
transform.createFolder = transform.getFolderInformation; | ||
transform.updateFile = transform.getFileInformation; | ||
transform.updateFileInformation = transform.getFileInformation; | ||
@@ -197,0 +199,0 @@ /////////////////////////////////////////////////////////////////////////////// |
{ | ||
"name": "filefog-google", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "google drive provider for filefog", | ||
@@ -5,0 +5,0 @@ "author": "Jason Kulatunga <jason@thesparktree.com>", |
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
23765
635