yahoo-fantasy
Advanced tools
Comparing version 0.4.2 to 0.4.3
@@ -9,3 +9,3 @@ var _ = require('lodash'); | ||
if(arrayOfObjects){ | ||
if(arrayOfObjects){ | ||
_.forEach(arrayOfObjects, function(obj) { | ||
@@ -19,6 +19,6 @@ _.forEach(_.keys(obj), function(key) { | ||
} | ||
return destinationObj; | ||
}; | ||
var playerObj = mergeObjects(player); | ||
@@ -31,4 +31,9 @@ | ||
playerObj.selected_position = playerObj.selected_position[1].position; | ||
playerObj.starting_status = ( playerObj.starting_status ) ? playerObj.starting_status[1].is_starting : 0; | ||
if ( playerObj.selected_position ) { | ||
playerObj.selected_position = playerObj.selected_position[1].position; | ||
} | ||
if ( playerObj.starting_status ) { | ||
playerObj.starting_status = ( playerObj.starting_status ) ? playerObj.starting_status[1].is_starting : 0; | ||
} | ||
@@ -35,0 +40,0 @@ return playerObj; |
{ | ||
"name": "yahoo-fantasy", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"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,8 @@ Yahoo! Fantasy API Node Module | ||
#### 0.4.3 | ||
* Added weeks param for league.scoreboard | ||
* Added weeks param for team.matchups | ||
* Fixed a bug where individual players weren't mapping properly | ||
* Minor code cleanup | ||
#### 0.4.2 | ||
@@ -60,0 +66,0 @@ * Added the ability to specify a date or week when querying the roster resource. |
@@ -68,3 +68,2 @@ var leagueHelper = require('../helpers/leagueHelper.js'); | ||
// todo: do i want the stats for each category as well? | ||
league.standings = standings; | ||
@@ -76,6 +75,15 @@ | ||
// h2h only | ||
// todo: add weeks param | ||
LeagueResource.prototype.scoreboard = function(leagueKey, cb) { | ||
LeagueResource.prototype.scoreboard = function(leagueKey, week, cb) { | ||
var url = 'http://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/scoreboard' | ||
if ( 2 == arguments.length ) { | ||
cb = week; | ||
week = null; | ||
} else if ( 3 == arguments.length ) { | ||
url += ';week=' + week; | ||
} | ||
var apiCallback = this._scoreboard_callback.bind(this, cb); | ||
url += '?format=json'; | ||
this | ||
@@ -85,3 +93,3 @@ .yf | ||
this.yf.GET, | ||
'http://fantasysports.yahooapis.com/fantasy/v2/league/' + leagueKey + '/scoreboard?format=json', | ||
url, | ||
apiCallback | ||
@@ -88,0 +96,0 @@ ); |
@@ -35,8 +35,16 @@ var playerHelper = require('../helpers/playerHelper.js'); | ||
*/ | ||
PlayerResource.prototype.stats = function(playerKey, cb) { | ||
PlayerResource.prototype.stats = function(playerKey, week, cb) { | ||
var url = 'http://fantasysports.yahooapis.com/fantasy/v2/player/' + playerKey + '/stats'; | ||
if ( 2 == arguments.length ) { | ||
cb = week; | ||
week = null; | ||
} else if ( 3 == arguments.length ) { | ||
url += ';week=' + week; | ||
} | ||
var apiCallback = this._stats_callback.bind(this, cb); | ||
// todo: can get this by week and/or by season... | ||
// { week: [WEEKNUM] } | ||
//;type=week;week=12 | ||
url += '?format=json'; | ||
this | ||
@@ -46,3 +54,3 @@ .yf | ||
this.yf.GET, | ||
'http://fantasysports.yahooapis.com/fantasy/v2/player/' + playerKey + '/stats?format=json', | ||
url, | ||
apiCallback | ||
@@ -82,4 +90,4 @@ ); | ||
var player = playerHelper.mapPlayer(data.fantasy_content.player[0]); | ||
// todo: do we need coverage type and/or delta???? | ||
// wtf are those about?!? | ||
player.percent_owned = percent_owned; | ||
@@ -108,3 +116,2 @@ | ||
// move this to helper? not really re-used... | ||
var league = data.fantasy_content.league[0]; | ||
@@ -118,9 +125,3 @@ var player = playerHelper.mapPlayer(data.fantasy_content.league[1].players[0].player[0]); | ||
player.league = league; | ||
// var isOwned = data.fantasy_content; | ||
// var isOwned = d.fantasy_content.player[1].percent_owned[1]; | ||
// var player = playerHelper.mapPlayer(d.fantasy_content.player[0]); | ||
// todo: what's the data like when the player isn't owned? | ||
// todo: worth returning more info of the team | ||
return cb(null, player); | ||
@@ -127,0 +128,0 @@ }; |
@@ -46,5 +46,2 @@ var teamHelper = require('../helpers/teamHelper.js'); | ||
return cb(null, team); | ||
}; | ||
// todo: need to add date, week | ||
// https://developer.yahoo.com/fantasysports/guide/roster-resource.html#roster-resource-desc | ||
}; |
@@ -117,6 +117,19 @@ var teamHelper = require('../helpers/teamHelper.js'); | ||
// h2h leagues only | ||
// todo: add weeks param | ||
TeamResource.prototype.matchups = function(teamKey, cb) { | ||
TeamResource.prototype.matchups = function(teamKey, weeks, cb) { | ||
var url = 'http://fantasysports.yahooapis.com/fantasy/v2/team/' + teamKey + '/matchups'; | ||
if ( 2 == arguments.length ) { | ||
cb = weeks; | ||
weeks = null; | ||
} else if ( 3 == arguments.length ) { | ||
if ( Array.isArray(weeks) ) { | ||
weeks = weeks.join(','); | ||
} | ||
url += ';weeks=' + weeks; | ||
} | ||
var apiCallback = this._matchups_callback.bind(this, cb); | ||
url += '?format=json'; | ||
this | ||
@@ -126,3 +139,3 @@ .yf | ||
this.yf.GET, | ||
'http://fantasysports.yahooapis.com/fantasy/v2/team/' + teamKey + '/matchups?format=json', | ||
url, | ||
apiCallback | ||
@@ -129,0 +142,0 @@ ); |
@@ -33,5 +33,4 @@ var transactionHelper = require('../helpers/transactionHelper.js'); | ||
TransactionResource.prototype.players = function(transactionKey, cb) { | ||
// same as meta?? just with the players... which we want... | ||
this.meta(transactionKey, cb); | ||
}; | ||
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
722522
4957
100