yahoo-fantasy
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -60,2 +60,15 @@ var _ = require('lodash'); | ||
exports.mapOwnership = function(ownership) { | ||
var o = { | ||
ownership_type: ownership.ownership_type | ||
}; | ||
if ('team' == o.ownership_type) { | ||
o.owner_team_key = ownership.owner_team_key; | ||
o.owner_team_name = ownership.owner_team_name; | ||
} | ||
return o; | ||
}; | ||
exports.mapDraftAnalysis = function(da) { | ||
@@ -89,3 +102,3 @@ return { | ||
case 'ownership': | ||
player.ownership = p[idx + 1].ownership; | ||
player.ownership = self.mapOwnership(p[idx + 1].ownership); | ||
break; | ||
@@ -92,0 +105,0 @@ |
{ | ||
"name": "yahoo-fantasy", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "An API to help facilitate the use of the Yahoo! Fantasy Sports API in NodeJS projects.", | ||
@@ -32,5 +32,6 @@ "main": "index.js", | ||
"istanbul": "^0.4.3", | ||
"jasmine": "^2.4.1", | ||
"nock": "^3.3.2" | ||
"nock": "^3.3.2", | ||
"q": "^1.4.1", | ||
"jasmine-node": "^1.14.5" | ||
} | ||
} |
@@ -58,2 +58,5 @@ Yahoo! Fantasy API Node Module | ||
#### 2.0.3 | ||
* Fixed a bug where the league players collection was not properly parsing the ownership subresource | ||
#### 2.0.2 | ||
@@ -60,0 +63,0 @@ * Fixed a bug where "mapTeamPoints" helper function was not defining "self". Thanks [platky](https://github.com/platky)! |
@@ -12,3 +12,3 @@ var gameHelper = require('../helpers/gameHelper.js'); | ||
var apiCallback = this._meta_callback.bind(this, cb); | ||
this | ||
@@ -18,3 +18,3 @@ .yf | ||
this.yf.GET, | ||
'https://fantasysports.yahooapis.com/fantasy/v2/game/' + gameKey + '/metadata?format=json', | ||
'https://fantasysports.yahooapis.com/fantasy/v2/game/' + gameKey + '/metadata?format=json', | ||
apiCallback | ||
@@ -26,3 +26,3 @@ ); | ||
if ( e ) return cb(e); | ||
var meta = data.fantasy_content.game[0]; | ||
@@ -35,3 +35,3 @@ return cb(null, meta); | ||
var apiCallback = this._leagues_callback.bind(this, cb); | ||
if ( typeof leagueKey === 'string' ) { | ||
@@ -52,3 +52,3 @@ leagueKey = [leagueKey]; | ||
if ( e ) return cb(e); | ||
var leagues = gameHelper.mapLeagues(data.fantasy_content.game[1].leagues); | ||
@@ -64,3 +64,3 @@ var game = data.fantasy_content.game[0]; | ||
var apiCallback = this._players_callback.bind(this, cb); | ||
if ( typeof playerKey === 'string' ) { | ||
@@ -81,3 +81,3 @@ playerKey = [playerKey]; | ||
if ( e ) return cb(e); | ||
var players = gameHelper.mapPlayers(data.fantasy_content.game[1].players); | ||
@@ -93,3 +93,3 @@ var game = data.fantasy_content.game[0]; | ||
var apiCallback = this._game_weeks_callback.bind(this, cb); | ||
this | ||
@@ -106,3 +106,3 @@ .yf | ||
if ( e ) return cb(e); | ||
var weeks = gameHelper.mapWeeks(data.fantasy_content.game[1].game_weeks); | ||
@@ -118,3 +118,3 @@ var game = data.fantasy_content.game[0]; | ||
var apiCallback = this._stat_categories_callback.bind(this, cb); | ||
this | ||
@@ -131,3 +131,3 @@ .yf | ||
if ( e ) return cb(e); | ||
var stat_categories = gameHelper.mapStatCategories(data.fantasy_content.game[1].stat_categories.stats); | ||
@@ -143,3 +143,3 @@ var game = data.fantasy_content.game[0]; | ||
var apiCallback = this._position_types_callback.bind(this, cb); | ||
this | ||
@@ -156,3 +156,3 @@ .yf | ||
if ( e ) return cb(e); | ||
var position_types = gameHelper.mapPositionTypes(data.fantasy_content.game[1].position_types); | ||
@@ -168,3 +168,3 @@ var game = data.fantasy_content.game[0]; | ||
var apiCallback = this._roster_positions_callback.bind(this, cb); | ||
this | ||
@@ -181,3 +181,3 @@ .yf | ||
if ( e ) return cb(e); | ||
var roster_positions = gameHelper.mapRosterPositions(data.fantasy_content.game[1].roster_positions); | ||
@@ -189,2 +189,2 @@ var game = data.fantasy_content.game[0]; | ||
return cb(null, game); | ||
}; | ||
}; |
@@ -15,3 +15,3 @@ var playerHelper = require('../helpers/playerHelper.js'); | ||
var apiCallback = this._meta_callback.bind(this, cb); | ||
this | ||
@@ -28,3 +28,3 @@ .yf | ||
if ( e ) return cb(e); | ||
var meta = playerHelper.mapPlayer(data.fantasy_content.player[0]); | ||
@@ -38,4 +38,4 @@ return cb(null, meta); | ||
PlayerResource.prototype.stats = function(playerKey, week, cb) { | ||
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/player/' + playerKey + '/stats'; | ||
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/player/' + playerKey + '/stats'; | ||
if ( 2 == arguments.length ) { | ||
@@ -47,7 +47,7 @@ cb = week; | ||
} | ||
var apiCallback = this._stats_callback.bind(this, cb); | ||
url += '?format=json'; | ||
this | ||
@@ -64,3 +64,3 @@ .yf | ||
if ( e ) return cb(e); | ||
var stats = playerHelper.mapStats(data.fantasy_content.player[1].player_stats); | ||
@@ -78,3 +78,3 @@ var player = playerHelper.mapPlayer(data.fantasy_content.player[0]); | ||
var apiCallback = this._percent_owned_callback.bind(this, cb); | ||
this | ||
@@ -91,6 +91,6 @@ .yf | ||
if ( e ) return cb(e); | ||
var percent_owned = data.fantasy_content.player[1].percent_owned[1]; | ||
var player = playerHelper.mapPlayer(data.fantasy_content.player[0]); | ||
// todo: do we need coverage type and/or delta???? | ||
@@ -107,3 +107,3 @@ player.percent_owned = percent_owned; | ||
var apiCallback = this._ownership_callback.bind(this, cb); | ||
this | ||
@@ -120,3 +120,3 @@ .yf | ||
if ( e ) return cb(e); | ||
var league = data.fantasy_content.league[0]; | ||
@@ -130,3 +130,3 @@ var player = playerHelper.mapPlayer(data.fantasy_content.league[1].players[0].player[0]); | ||
player.league = league; | ||
return cb(null, player); | ||
@@ -140,3 +140,3 @@ }; | ||
var apiCallback = this._draft_analysis_callback.bind(this, cb); | ||
this | ||
@@ -153,3 +153,3 @@ .yf | ||
if ( e ) return cb(e); | ||
var draft_analysis = playerHelper.mapDraftAnalysis(data.fantasy_content.player[1].draft_analysis); | ||
@@ -156,0 +156,0 @@ var player = playerHelper.mapPlayer(data.fantasy_content.player[0]); |
@@ -11,3 +11,3 @@ var teamHelper = require('../helpers/teamHelper.js'); | ||
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/team/' + teamKey + '/roster'; | ||
if ( 2 == arguments.length ) { | ||
@@ -23,9 +23,9 @@ cb = date; | ||
url += ';week=' + date; | ||
} | ||
} | ||
} | ||
var apiCallback = this._players_callback.bind(this, cb); | ||
var apiCallback = this._players_callback.bind(this, cb); | ||
url += '?format=json'; | ||
this | ||
@@ -42,3 +42,3 @@ .yf | ||
if ( e ) return cb(e); | ||
var team = teamHelper.mapTeam(data.fantasy_content.team[0]); | ||
@@ -49,2 +49,2 @@ var roster = teamHelper.mapRoster(data.fantasy_content.team[1].roster); | ||
return cb(null, team); | ||
}; | ||
}; |
@@ -11,3 +11,3 @@ var teamHelper = require('../helpers/teamHelper.js'); | ||
var apiCallback = this._meta_callback.bind(this, cb); | ||
this | ||
@@ -24,3 +24,3 @@ .yf | ||
if ( e ) return cb(e); | ||
var metadata = teamHelper.mapTeam(data.fantasy_content.team[0]); | ||
@@ -32,3 +32,3 @@ return cb(null, metadata); | ||
var apiCallback = this._stats_callback.bind(this, cb); | ||
this | ||
@@ -45,3 +45,3 @@ .yf | ||
if ( e ) return cb(e); | ||
var stats = teamHelper.mapStats(data.fantasy_content.team[1]); | ||
@@ -56,3 +56,3 @@ var team = teamHelper.mapTeam(data.fantasy_content.team[0]); | ||
var apiCallback = this._standings_callback.bind(this, cb); | ||
this | ||
@@ -69,3 +69,3 @@ .yf | ||
if ( e ) return cb(e); | ||
var standings = data.fantasy_content.team[1].team_standings; | ||
@@ -80,3 +80,3 @@ var team = teamHelper.mapTeam(data.fantasy_content.team[0]); | ||
var apiCallback = this._roster_callback.bind(this, cb); | ||
this | ||
@@ -93,3 +93,3 @@ .yf | ||
if ( e ) return cb(e); | ||
var team = teamHelper.mapTeam(data.fantasy_content.team[0]); | ||
@@ -104,3 +104,3 @@ var roster = teamHelper.mapRoster(data.fantasy_content.team[1].roster); | ||
var apiCallback = this._draft_results_callback.bind(this, cb); | ||
this | ||
@@ -117,3 +117,3 @@ .yf | ||
if ( e ) return cb(e); | ||
var draft_results = teamHelper.mapDraft(data.fantasy_content.team[1].draft_results); | ||
@@ -129,3 +129,3 @@ var team = teamHelper.mapTeam(data.fantasy_content.team[0]); | ||
var url = 'https://fantasysports.yahooapis.com/fantasy/v2/team/' + teamKey + '/matchups'; | ||
if ( 2 == arguments.length ) { | ||
@@ -138,9 +138,9 @@ cb = weeks; | ||
} | ||
url += ';weeks=' + weeks; | ||
url += ';weeks=' + weeks; | ||
} | ||
var apiCallback = this._matchups_callback.bind(this, cb); | ||
url += '?format=json'; | ||
this | ||
@@ -157,3 +157,3 @@ .yf | ||
if ( e ) return cb(e); | ||
var matchups = teamHelper.mapMatchups(data.fantasy_content.team[1].matchups); | ||
@@ -164,2 +164,2 @@ var team = teamHelper.mapTeam(data.fantasy_content.team[0]); | ||
return cb(null, team); | ||
}; | ||
}; |
@@ -11,3 +11,3 @@ var transactionHelper = require('../helpers/transactionHelper.js'); | ||
var apiCallback = this._meta_callback.bind(this, cb); | ||
this | ||
@@ -24,3 +24,3 @@ .yf | ||
if ( e ) return cb(e); | ||
var transaction = data.fantasy_content.transaction; | ||
@@ -27,0 +27,0 @@ var meta = transaction[0]; |
@@ -11,3 +11,3 @@ var userHelper = require('../helpers/userHelper.js'); | ||
var apiCallback = this._games_callback.bind(this, cb); | ||
this | ||
@@ -24,3 +24,3 @@ .yf | ||
if ( e ) return cb(e); | ||
var user = data.fantasy_content.users[0].user[0]; | ||
@@ -35,3 +35,3 @@ var games = userHelper.mapGames(data.fantasy_content.users[0].user[1].games); | ||
var apiCallback = this._game_leagues_callback.bind(this, cb); | ||
// todo: get stats from other users... | ||
@@ -53,3 +53,3 @@ if ( !Array.isArray(gameKeys) ) { | ||
if ( e ) return cb(e); | ||
var user = data.fantasy_content.users[0].user[0]; | ||
@@ -64,3 +64,3 @@ var leagues = userHelper.mapUserLeagues(data.fantasy_content.users[0].user[1].games); | ||
var apiCallback = this._game_teams_callback.bind(this, cb); | ||
if ( !Array.isArray(gameKeys) ) { | ||
@@ -81,3 +81,3 @@ gameKeys = [ gameKeys ]; | ||
if ( e ) return cb(e); | ||
var user = data.fantasy_content.users[0].user[0]; | ||
@@ -88,2 +88,2 @@ var teams = userHelper.mapUserTeams(data.fantasy_content.users[0].user[1].games); | ||
return cb(null, user); | ||
}; | ||
}; |
Sorry, the diff of this file is not supported yet
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
731395
77
5110
138
4