googleapis
Advanced tools
Comparing version 0.2.4-alpha to 0.2.5-alpha
@@ -17,7 +17,8 @@ /** | ||
var Client = require('./client.js'), | ||
var async = require('async'), | ||
Cache = require('./cache.js'), | ||
Client = require('./client.js'), | ||
DefaultTransporter = require('./transporters.js'), | ||
qs = require('querystring'), | ||
requests = require('./requests.js'), | ||
DefaultTransporter = require('./transporters.js'), | ||
async = require('async'); | ||
requests = require('./requests.js'); | ||
@@ -55,2 +56,3 @@ /** | ||
this.toBeDiscovered = []; | ||
this.cache = new Cache(); | ||
this.transporter = exports.Transporter || new DefaultTransporter(); | ||
@@ -134,12 +136,20 @@ } | ||
var that = this; | ||
// make the request and generate client | ||
var opts = { | ||
uri: this.generateDiscoveryUrl(api), json: true | ||
}; | ||
this.transporter.request(opts, function(err, json, res) { | ||
var generateClient = function(err, data) { | ||
var client = null; | ||
if (!err && json) { client = new Client(json); } | ||
if (!err && data) { | ||
that.cache.write(api, data); | ||
client = new Client(data); | ||
} | ||
opt_callback && opt_callback(err, client); | ||
}); | ||
}; | ||
var data = this.cache.load(api); | ||
if (data) { | ||
generateClient(null, data); | ||
} else { | ||
that.transporter.request({ | ||
uri: that.generateDiscoveryUrl(api), json: true | ||
}, generateClient); | ||
} | ||
}; | ||
@@ -175,2 +185,7 @@ | ||
/** | ||
* Shortcut to GoogleApis. | ||
*/ | ||
googleapis.GoogleApis = GoogleApis; | ||
/** | ||
* Shortcut to OAuth2Client. | ||
@@ -177,0 +192,0 @@ */ |
@@ -75,3 +75,6 @@ /** | ||
} | ||
url += '?' + querystring.stringify(opt_params); | ||
var params = querystring.stringify(opt_params); | ||
if (params) { | ||
url += '?' + params; | ||
} | ||
return url; | ||
@@ -78,0 +81,0 @@ }; |
{ | ||
"name": "googleapis", | ||
"version": "0.2.4-alpha", | ||
"version": "0.2.5-alpha", | ||
"author": "Google Inc.", | ||
@@ -5,0 +5,0 @@ "description": "Google APIs Client Library for Node.js", |
@@ -48,6 +48,6 @@ # google-api-nodejs-client [alpha] | ||
Client libraries are generated during runtime by metadata provided by Google | ||
APIs Discovery Service. Metadata provided by Discovery Service is not cached, | ||
but requested each time you load a client. We're making changes to improve the | ||
situation for short-lived node processes. Below, there is an example of loading | ||
a client for [URL Shortener API](https://developers.google.com/url-shortener/). | ||
APIs Discovery Service. Metadata provided by Discovery Service is cached, | ||
and won't be requested each time you load a client. Below, there is an | ||
example of loading a client for | ||
[URL Shortener API](https://developers.google.com/url-shortener/). | ||
@@ -54,0 +54,0 @@ googleapis |
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
98815
14
920
0
1