Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 60 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,55 @@ var options = {
key: '' // <-- Pass in your nhl key here
}
};

var options_v3_stats = {
timeout: 15000, // Service call timeout
nba: {
version: 'v3/nba/stats',
key: '' // <-- Pass in your nba key here
},
nfl: {
version: 'v3/nfl/stats',
key: '' // <-- Pass in your nfl key here
}
};

var options_v3_scores = {
timeout: 15000, // Service call timeout
nba: {
version: 'v3/nba/scores',
key: '' // <-- Pass in your nba key here
},
nfl: {
version: 'v3/nfl/scores',
key: '' // <-- Pass in your nfl key here
}
};

var options_v3_projections = {
timeout: 15000, // Service call timeout
nba: {
version: 'v3/nba/projections',
key: '' // <-- Pass in your nba key here
},
nfl: {
version: 'v3/nfl/projections',
key: '' // <-- Pass in your nfl key here
}
};

var options_v3_pbp = {
timeout: 15000, // Service call timeout
nba: {
version: 'v3/nba/pbp',
key: '' // <-- Pass in your nba key here
},
nfl: {
version: 'v3/nfl/pbp',
key: '' // <-- Pass in your nfl key here
}
};

```

## Example Usage
Expand All @@ -53,6 +102,14 @@ var season = '2014REG';
fantasyData.nfl.Byes(season, function(err, results){
console.log(JSON.stringify(results, null, 2));
});

var fantasyDataV3Scores = require('fantasydata-api')(options_v3_scores);

var season = '2014REG';
fantasyDataV3Scores.nfl.Byes(season, function(err, results){
console.log(JSON.stringify(results, null, 2));
});

```

## Parameters
Expand Down Expand Up @@ -140,6 +197,7 @@ All methods are asynchronous and require the last parameter to be a callback fun
* ```.playerGameStatsByPlayerId(season, week, playerId, callback)```
* ```.playerGameStatsByTeam(season, week, team, callback)```
* ```.playerGameStatsByWeek(season, week, callback)```
* ```.playerSeasonStats(season, callback)```
* ```.playerSeasonStatsByPlayerId(season, playerId, callback)```
* ```.playerSeasonStatsByTeam(season, team, callback)```
* ```.recentlyUpdatedBoxScores(minutes, callback)```
Expand Down Expand Up @@ -174,6 +232,7 @@ All methods are asynchronous and require the last parameter to be a callback fun
* ```.playerSeasonStats(season, callback)```
* ```.playerSeasonStatsByTeam(season, team, callback)```
* ```.playersByTeam(team, callback)```
* ```.player(playerId, callback)```
* ```.playerGameProjectionStatsByDate(dateStr, callback)```
* ```.stadiums(callback)```
* ```.teamGameStatsByDate(dateStr, callback)```
Expand Down Expand Up @@ -244,4 +303,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"author": "Nate Clark <n8@n8io.com>",
"license": "MIT",
"dependencies": {
"async": "^1.4.2",
"async": "^1.5.2",
"lodash": "^3.10.1",
"request": "^2.65.0"
"request": "^2.79.0"
},
"devDependencies": {
"chai": "^3.4.0",
"chai": "^3.5.0",
"codeclimate-test-reporter": "^0.1.1",
"istanbul": "^0.4.0",
"mocha": "^2.3.3"
"istanbul": "^0.4.5",
"mocha": "^2.5.3"
}
}
24 changes: 18 additions & 6 deletions server/fantasydata-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ module.exports = function(options) {

makeRequest(uri, callback);
}

FantasyData.nhl.playerDetailsByPlayer = function (playerId, callback) {
var uri = buildNhlUrl('Player/{{playerId}}', {
playerId: playerId,
Expand Down Expand Up @@ -251,7 +251,7 @@ module.exports = function(options) {

makeRequest(uri, callback);
}

FantasyData.mlb.playerDetailsByPlayer = function (playerId, callback) {
var uri = buildMlbUrl('Player/{{playerId}}', {
playerId: playerId,
Expand All @@ -265,14 +265,14 @@ module.exports = function(options) {

makeRequest(uri, callback);
}

FantasyData.mlb.playerGameStatsByPlayer = function(gameDateStr, playerId, callback) {
var uri = buildMlbUrl('PlayerGameStatsByPlayer/{{gameDateStr}}/{{playerId}}', {gameDateStr: gameDateStr, playerId: playerId});

makeRequest(uri, callback);
}



FantasyData.mlb.playerSeasonStats = function(season, callback) {
var uri = buildMlbUrl('PlayerSeasonStats/{{season}}', {season: season});
Expand All @@ -297,7 +297,7 @@ module.exports = function(options) {

makeRequest(uri, callback);
}

FantasyData.mlb.playerGameProjectionStatsByPlayer = function(gameDateStr, playerId, callback) {
var uri = buildMlbUrl('PlayerGameProjectionStatsByPlayer/{{gameDateStr}}/{{playerId}}', {gameDateStr: gameDateStr, playerId: playerId});

Expand Down Expand Up @@ -420,6 +420,12 @@ module.exports = function(options) {
makeRequest(uri, callback);
}

FantasyData.nba.player = function(playerId, callback) {
var uri = buildNbaUrl('Player/{{playerId}}', {playerId: playerId});

makeRequest(uri, callback);
};

FantasyData.nba.playerGameProjectionStatsByDate = function(gameDateStr, callback) {
var uri = buildNbaUrl('PlayerGameProjectionStatsByDate/{{gameDateStr}}', {gameDateStr: gameDateStr});

Expand Down Expand Up @@ -632,6 +638,12 @@ module.exports = function(options) {
makeRequest(uri, callback);
};

FantasyData.nfl.playerSeasonStats = function(season, callback) {
var uri = buildNflUrl('PlayerSeasonStats/{{season}}', {season: season});

makeRequest(uri, callback);
};

FantasyData.nfl.playerSeasonStatsByPlayerId = function(season, playerId, callback) {
var uri = buildNflUrl('PlayerSeasonStatsByPlayerId/{{season}}/{{playerId}}', {season: season, playerId: playerId});

Expand Down
12 changes: 12 additions & 0 deletions test/config_v3_pbp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"debug": false,
"timeout": 15000,
"nfl": {
"key": "",
"version": "v3/nfl/pbp"
},
"nba": {
"key": "",
"version": "v3/nba/pbp"
}
}
12 changes: 12 additions & 0 deletions test/config_v3_projections.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"debug": false,
"timeout": 15000,
"nfl": {
"key": "",
"version": "v3/nfl/projections"
},
"nba": {
"key": "",
"version": "v3/nba/projections"
}
}
12 changes: 12 additions & 0 deletions test/config_v3_scores.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"debug": false,
"timeout": 15000,
"nfl": {
"key": "",
"version": "v3/nfl/scores"
},
"nba": {
"key": "",
"version": "v3/nba/scores"
}
}
12 changes: 12 additions & 0 deletions test/config_v3_stats.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"debug": false,
"timeout": 15000,
"nfl": {
"key": "",
"version": "v3/nfl/stats"
},
"nba": {
"key": "",
"version": "v3/nba/stats"
}
}
Loading