google-finance-service
Advanced tools
Comparing version 0.0.0 to 0.0.1
var $ = require('jquery'); | ||
module.exports = function (symbols, exchange) { | ||
module.exports = function (symbols, success, error) { | ||
if (Array.isArray(symbols)) { | ||
@@ -14,5 +14,8 @@ symbols = symbols.join(); | ||
dataType: "jsonp", | ||
cache: true | ||
cache: true, | ||
success: success, | ||
error: error | ||
}; | ||
return $.ajax(options); | ||
$.ajax(options); | ||
return this; | ||
}; |
{ | ||
"name": "google-finance-service", | ||
"version": "0.0.0", | ||
"description": "", | ||
"version": "0.0.1", | ||
"description": "Simple browser-friendly micro service for the google finance api", | ||
"keywords": ["browser", "client", "google", "finance", "micro-service"], | ||
"main": "index.js", | ||
@@ -24,3 +25,3 @@ "directories": { | ||
"author": "tomkp", | ||
"license": "BSD-2-Clause", | ||
"license": "MIT", | ||
"bugs": { | ||
@@ -27,0 +28,0 @@ "url": "https://github.com/tomkp/google-finance-service/issues" |
#Examples | ||
# google-finance-service | ||
## Symbols as an Array | ||
Simple browser-friendly micro service for the google finance api | ||
[![Build Status](https://travis-ci.org/tomkp/google-finance-service.png)](https://travis-ci.org/tomkp/google-finance-service) | ||
### Symbols as an Array | ||
``` | ||
var service = require('google-finance-service'); | ||
$.when( | ||
service(['LON:TSCO', 'LON:RDSA']) | ||
).then( | ||
function (data) {} | ||
); | ||
service(['LON:TSCO', 'LON:RDSA'], function (data) { /* success */ }, function (data) { /* error */ }); | ||
``` | ||
## Symbols as a String | ||
### Symbols as a String | ||
``` | ||
var service = require('google-finance-service'); | ||
$.when( | ||
service('LON:TSCO,LON:RDSA') | ||
).then( | ||
function (data) {} | ||
); | ||
``` | ||
service('LON:TSCO,LON:RDSA', function (data) { /* success */ }, function (data) { /* error */ }); | ||
``` |
@@ -8,15 +8,12 @@ var assert = require('assert'); | ||
it('fetches for comma separated list of symbols', function (done) { | ||
$.when( | ||
service('LON:TSCO,NASDAQ:GOOG') | ||
).then( | ||
function (data) { | ||
console.info('success', data); | ||
assert.equal(2, data.length); | ||
assert.equal('Tesco PLC', data[0].name); | ||
assert.equal('TSCO', data[0].t); | ||
assert.equal('Google Inc', data[1].name); | ||
assert.equal('GOOG', data[1].t); | ||
done(); | ||
} | ||
); | ||
service('LON:TSCO,NASDAQ:GOOG', function (data) { | ||
console.info('success', data); | ||
assert.equal(2, data.length); | ||
assert.equal('Tesco PLC', data[0].name); | ||
assert.equal('TSCO', data[0].t); | ||
assert.equal('Google Inc', data[1].name); | ||
assert.equal('GOOG', data[1].t); | ||
done(); | ||
}); | ||
}); | ||
@@ -26,15 +23,12 @@ | ||
it('fetches for array of symbols', function (done) { | ||
$.when( | ||
service(['LON:TSCO', 'NASDAQ:GOOG']) | ||
).then( | ||
function (data) { | ||
console.info('success', data); | ||
assert.equal(2, data.length); | ||
assert.equal('Tesco PLC', data[0].name); | ||
assert.equal('TSCO', data[0].t); | ||
assert.equal('Google Inc', data[1].name); | ||
assert.equal('GOOG', data[1].t); | ||
done(); | ||
} | ||
); | ||
service(['LON:TSCO', 'NASDAQ:GOOG'], function (data) { | ||
console.info('success', data); | ||
assert.equal(2, data.length); | ||
assert.equal('Tesco PLC', data[0].name); | ||
assert.equal('TSCO', data[0].t); | ||
assert.equal('Google Inc', data[1].name); | ||
assert.equal('GOOG', data[1].t); | ||
done(); | ||
}); | ||
}); | ||
@@ -41,0 +35,0 @@ |
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
3001
6
44
23