Skip to content

Loading…

Add injuries report to API calls for NBA. #2

Merged
merged 1 commit into from

2 participants

@queso

No description provided.

@rgerard
Owner

LGTM

@rgerard rgerard merged commit 14f9249 into rgerard:master
@rgerard
Owner

Published updated NPM as well

@queso

Thx for getting on this so quick!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 29, 2014
  1. @queso
Showing with 24 additions and 0 deletions.
  1. +9 −0 index_nba.js
  2. +15 −0 util/url_helper_nba.js
View
9 index_nba.js
@@ -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);
+ }
};
View
15 util/url_helper_nba.js
@@ -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();
+ }
}
Something went wrong with that request. Please try again.