yahoo-fantasy
Advanced tools
Comparing version 0.4.0 to 0.4.1
34
index.js
@@ -72,14 +72,30 @@ /* global module, require */ | ||
YahooFantasy.prototype.api = function(method, url, cb) { | ||
var callback = this.apiCallback.bind(this, method, url, cb); | ||
YahooFantasy.prototype.api = function(method, url, postData, cb) { | ||
if ( arguments.length == 3 ) { | ||
cb = postData; | ||
postData = null; | ||
} | ||
this.oauth[method.toLowerCase()]( | ||
url, | ||
this.yuser.token, | ||
this.yuser.secret, | ||
callback | ||
); | ||
var callback = this.apiCallback.bind(this, method, url, postData, cb); | ||
if ( this.POST == method ) { | ||
this.oauth.post( | ||
url, | ||
this.yuser.token, | ||
this.yuser.secret, | ||
postData, | ||
'application/xml', | ||
callback | ||
); | ||
} else { | ||
this.oauth.get( | ||
url, | ||
this.yuser.token, | ||
this.yuser.secret, | ||
callback | ||
); | ||
} | ||
}; | ||
YahooFantasy.prototype.apiCallback = function(method, url, cb, e, data, resp) { | ||
YahooFantasy.prototype.apiCallback = function(method, url, postData, cb, e, data, resp) { | ||
try { | ||
@@ -86,0 +102,0 @@ data = JSON.parse(data); |
{ | ||
"name": "yahoo-fantasy", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "An API to help facilitate the use of the Yahoo! Fantasy Sports API in NodeJS projects.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -58,2 +58,5 @@ Yahoo! Fantasy API Node Module | ||
#### 0.4.1 | ||
* Fixes to how POST data is handled | ||
#### 0.4.0 | ||
@@ -60,0 +63,0 @@ * Significantly restructured the code to have more consistency and set it up better for future plans, namely POST methods and proper unit testing |
721930
4930
89