Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2 from Differential/injury

Add injuries report to API calls for NBA.
  • Loading branch information...
commit 14f9249a23ccf4896a6899b61a581e7057c8d7b1 2 parents 26b5c85 + c763c21
Ryan Gerard authored
Showing with 24 additions and 0 deletions.
  1. +9 −0 index_nba.js
  2. +15 −0 util/url_helper_nba.js
9 index_nba.js
View
@@ -51,6 +51,11 @@ function getStandings(callback) {
createRequest(url, callback);
}
+function getInjuries(callback) {
+ var url = urlHelper.getInjuriesUrl();
+ createRequest(url, callback);
+}
+
function createRequest(url, callback) {
request(url, function (error, response, body) {
@@ -95,4 +100,8 @@ module.exports = {
getStandings: function(callback) {
return getStandings(callback);
}
+
+ getInjuries: function(callback) {
+ return getInjuries(callback);
+ }
};
15 util/url_helper_nba.js
View
@@ -82,6 +82,17 @@ function createStandingsUrl() {
+ config.nba.apikey;
}
+function createInjuriesUrl() {
+
+ // URL should look like: http://api.sportsdatallc.org/nba-[access_level][version]/league/injuries.xml?api_key=[your_api_key]
+ return 'http://api.sportsdatallc.org/nba-'
+ + config.nba.access_level
+ + config.nba.version
+ + '/league/'
+ + '/injuries.xml?api_key='
+ + config.nba.apikey;
+}
+
module.exports = {
getSeasonScheduleUrl: function () {
@@ -103,4 +114,8 @@ module.exports = {
getStandingsUrl: function () {
return createStandingsUrl();
}
+
+ getInjuriesUrl: function () {
+ return createdInjuriesUrl();
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.