Skip to content

Commit c57e76a

Browse files
committed
fix dataset v3 call CBOE/VXEEM fixes normanjoyner#6
1 parent 6d4430d commit c57e76a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

lib/api.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,15 @@ module.exports = {
1515

1616
var qs = options;
1717
qs.auth_token = this.auth_token;
18+
if (this.api_version == 1) {
19+
this.last_uri_called = ["api", this.api_version, "datasets", code.source, code.table].join("/");
20+
} else {
21+
this.last_uri_called = "api/" + this.api_version + "/datasets/" + code.source;
22+
if (code.table) {
23+
this.last_uri_called += "/" + code.table;
24+
}
25+
}
1826

19-
this.last_uri_called = ["api", this.api_version, "datasets", code.source, code.table].join("/");
2027
var config = {
2128
uri: this.last_uri_called,
2229
format: format,

test/quandl.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe("quandl", function(){
4848
assert.equal(quandl.last_uri_called, "");
4949
});
5050

51-
it("has correct api call for v3", function() {
51+
it("has correct api call for dataset v3", function() {
5252
quandl.configure({
5353
api_version: 3,
5454
auth_token: "dsahFHUiewjjd"
@@ -60,7 +60,7 @@ describe("quandl", function(){
6060

6161
assert.equal(
6262
quandl.last_uri_called,
63-
"api/v1/datasets/CBOE/VXEEM.json");
63+
"api/v3/datasets/CBOE/VXEEM");
6464
});
6565
});
6666

0 commit comments

Comments
 (0)