Skip to content

Commit

Permalink
fix dataset v3 call CBOE/VXEEM fixes normanjoyner#6
Browse files Browse the repository at this point in the history
  • Loading branch information
Victory committed Jan 17, 2016
1 parent 6d4430d commit c57e76a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@ module.exports = {

var qs = options;
qs.auth_token = this.auth_token;
if (this.api_version == 1) {
this.last_uri_called = ["api", this.api_version, "datasets", code.source, code.table].join("/");
} else {
this.last_uri_called = "api/" + this.api_version + "/datasets/" + code.source;
if (code.table) {
this.last_uri_called += "/" + code.table;
}
}

this.last_uri_called = ["api", this.api_version, "datasets", code.source, code.table].join("/");
var config = {
uri: this.last_uri_called,
format: format,
Expand Down
4 changes: 2 additions & 2 deletions test/quandl.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe("quandl", function(){
assert.equal(quandl.last_uri_called, "");
});

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

assert.equal(
quandl.last_uri_called,
"api/v1/datasets/CBOE/VXEEM.json");
"api/v3/datasets/CBOE/VXEEM");
});
});

Expand Down

0 comments on commit c57e76a

Please sign in to comment.