Permalink
Browse files

add nba getRoster and fix injuries url

  • Loading branch information...
schnie committed Apr 9, 2014
1 parent 530f62c commit c65b75f34949b84be5910114518e816f0d0a3a07
Showing with 25 additions and 1 deletion.
  1. +9 −0 index_nba.js
  2. +16 −1 util/url_helper_nba.js
View
@@ -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
@@ -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 () {
@@ -116,6 +127,10 @@ module.exports = {
},
getInjuriesUrl: function () {
- return createdInjuriesUrl();
+ return createInjuriesUrl();
+ },
+
+ getRosterUrl: function (teamID) {
+ return createRosterUrl(teamID);
}
}

0 comments on commit c65b75f

Please sign in to comment.