googleapis
Advanced tools
Comparing version 0.2.5-alpha to 0.2.6-alpha
@@ -22,3 +22,4 @@ /** | ||
qs = require('querystring'), | ||
requests = require('./requests.js'); | ||
requests = require('./requests.js'), | ||
fs = require('fs'); | ||
@@ -136,2 +137,7 @@ /** | ||
if (api.opts && api.opts.localDiscoveryFilePath) { | ||
that.loadFromFile(api.opts.localDiscoveryFilePath, opt_callback); | ||
return; | ||
} | ||
var generateClient = function(err, data) { | ||
@@ -157,2 +163,17 @@ var client = null; | ||
/** | ||
* Generates a client from a local discovery file. | ||
* @param {String} filename Path of the local discovery file. | ||
* @param {Function=} opt_callback Optional callback function. | ||
*/ | ||
GoogleApis.prototype.loadFromFile = function(filename, opt_callback) { | ||
fs.readFile(filename, function(err, data) { | ||
var client = null; | ||
if (!err && data) { | ||
client = new Client(JSON.parse(data)); | ||
} | ||
opt_callback && opt_callback(err, client); | ||
}); | ||
} | ||
/** | ||
* Generates the discovery url. | ||
@@ -159,0 +180,0 @@ * @param {String} api An object to represent the api name, version and opts. |
{ | ||
"name": "googleapis", | ||
"version": "0.2.5-alpha", | ||
"version": "0.2.6-alpha", | ||
"author": "Google Inc.", | ||
@@ -5,0 +5,0 @@ "description": "Google APIs Client Library for Node.js", |
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
939
46348
12
2