googlemaps
Advanced tools
Comparing version 0.1.8 to 0.1.9
@@ -456,4 +456,12 @@ var qs = require('querystring'), | ||
args.client = config('google-client-id'); | ||
path = path + "?" + qs.stringify(args); | ||
var query = qs.stringify(args).split(''); | ||
for (var i = 0; i < query.length; ++i) { | ||
// request will escape these which breaks the signature | ||
if (query[i] === "'") query[i] = escape(query[i]); | ||
} | ||
query = query.join(''); | ||
path = path + "?" + query; | ||
// Create signer object passing in the key, telling it the key is in base64 format | ||
@@ -460,0 +468,0 @@ var signer = crypto.createHmac('sha1', config('google-private-key')); |
{ | ||
"name": "googlemaps", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"main": "./lib/googlemaps", | ||
@@ -5,0 +5,0 @@ "description": "A simple way to query the Google Maps API from Node.js", |
@@ -9,3 +9,3 @@ # Google Maps API for Node.js | ||
curl http://npmjs.org/install.sh | sh | ||
curl https://npmjs.org/install.sh | sh | ||
@@ -12,0 +12,0 @@ ### Installing googlemaps |
@@ -15,4 +15,4 @@ var vows = require('vows'), | ||
'returns expected lat/lng for Chicago': function(err, result){ | ||
assert.equal(result.routes[0].legs[0].steps[0].end_location.lat , 43.07330000000001); | ||
assert.equal(result.routes[0].legs[0].steps[0].end_location.lng , -89.40240000000001); | ||
assert.equal(result.routes[0].legs[0].steps[0].end_location.lat.toFixed(3) , 43.073); | ||
assert.equal(result.routes[0].legs[0].steps[0].end_location.lng.toFixed(3) , -89.402); | ||
} | ||
@@ -19,0 +19,0 @@ } |
var vows = require('vows'), | ||
assert = require('assert'), | ||
crypto = require('crypto'), | ||
gm = require('../lib/googlemaps'); | ||
@@ -55,4 +54,5 @@ | ||
'returns the expected static map PNG data': function(err, data){ | ||
var pos = data.indexOf('PNG'); | ||
assert.notEqual(pos, -1); | ||
// Look for the PNG header only | ||
var buf = new Buffer(data, 'binary'); | ||
assert.equal('89504e47', buf.toString('hex').substr(0,8)); | ||
} | ||
@@ -59,0 +59,0 @@ } |
var vows = require('vows'), | ||
assert = require('assert'), | ||
crypto = require('crypto'), | ||
gm = require('../lib/googlemaps'); | ||
function checkJPEGHeader(err, data){ | ||
// Look for the JPEG header only | ||
var buf = new Buffer(data, 'binary'); | ||
assert.equal(buf.toString('hex').substr(0,4), 'ffd8'); | ||
} | ||
vows.describe('streetview').addBatch({ | ||
@@ -22,7 +27,3 @@ 'Street View': { | ||
}, | ||
'returns the expected static map Image data': function(err, data){ | ||
var md5 = crypto.createHash('md5'); | ||
md5.update(data); | ||
assert.equal(md5.digest('hex') , 'a355992522bc7d640ba605268e703e37'); | ||
} | ||
'returns the expected Street View Image data': checkJPEGHeader | ||
}, | ||
@@ -43,7 +44,3 @@ | ||
}, | ||
'returns the expected static map Image data': function(err, data){ | ||
var md5 = crypto.createHash('md5'); | ||
md5.update(data); | ||
assert.equal(md5.digest('hex') , 'f408a7709312394a9ed88ad33cee6145'); | ||
} | ||
'returns the expected Street View Image data': checkJPEGHeader | ||
}, | ||
@@ -64,7 +61,3 @@ | ||
}, | ||
'returns the expected static map Image data': function(err, data){ | ||
var md5 = crypto.createHash('md5'); | ||
md5.update(data); | ||
assert.equal(md5.digest('hex') , 'a355992522bc7d640ba605268e703e37'); | ||
} | ||
'returns the expected Street View Image data': checkJPEGHeader | ||
}, | ||
@@ -71,0 +64,0 @@ |
92684
2442