Skip to content
Browse files

Merge pull request #4 from Differential/master

add nba getRoster
  • Loading branch information...
2 parents 1e738eb + c65b75f commit 10fd623e9ba9710b87ea322e4a2c3c347d2c3c45 @rgerard committed
Showing with 26 additions and 2 deletions.
  1. +9 −0 index_nba.js
  2. +17 −2 util/url_helper_nba.js
View
9 index_nba.js
@@ -56,6 +56,11 @@ function getInjuries(callback) {
createRequest(url, callback);
}
+function getRoster(teamID, callback) {
+ var url = urlHelper.getRosterUrl(teamID);
+ createRequest(url, callback);
+}
+
function createRequest(url, callback) {
request(url, function (error, response, body) {
@@ -103,5 +108,9 @@ module.exports = {
getInjuries: function(callback) {
return getInjuries(callback);
+ },
+
+ getRoster: function(teamID, callback) {
+ return getRoster(teamID, callback);
}
};
View
19 util/url_helper_nba.js
@@ -93,6 +93,17 @@ function createInjuriesUrl() {
+ config.nba.apikey;
}
+function createRosterUrl(teamID) {
+ // URL should look like: http://api.sportsdatallc.org/nba-[access_level][version]/teams/[team_id]/profile.xml?api_key=[your_api_key]
+ return 'http://api.sportsdatallc.org/nba-'
+ + config.nba.access_level
+ + config.nba.version
+ + '/teams/'
+ + teamID
+ + '/profile.xml?api_key='
+ + config.nba.apikey;
+}
+
module.exports = {
getSeasonScheduleUrl: function () {
@@ -113,9 +124,13 @@ module.exports = {
getStandingsUrl: function () {
return createStandingsUrl();
- }
+ },
getInjuriesUrl: function () {
- return createdInjuriesUrl();
+ return createInjuriesUrl();
+ },
+
+ getRosterUrl: function (teamID) {
+ return createRosterUrl(teamID);
}
}

0 comments on commit 10fd623

Please sign in to comment.
Something went wrong with that request. Please try again.