kimono-worldcup-api-wrapper
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -14,3 +14,3 @@ /* | ||
this.get = {}; | ||
this.apiRequest = this.get.players = this.get.player = this.get.teams = this.get.team = this.get.clubs = this.get.club = this.matches = this.match = {}; | ||
this.apiRequest = this.get.players = this.get.player = this.get.teams = this.get.team = this.get.clubs = this.get.club = this.matches = this.match = this.get.player_season_stats = {}; | ||
@@ -24,3 +24,4 @@ // Get all Players | ||
this.get.player = function (id, filters) { | ||
return apiRequest(host + 'player/' + id + apiKey + ((filters) ? '&' + qs.stringify(filters) : '')); | ||
return apiRequest(host + 'players/' + id + apiKey + ((filters) ? '&' + qs.stringify(filters) : '')); | ||
}; | ||
@@ -35,3 +36,3 @@ | ||
this.get.team = function(id, filters) { | ||
apiRequest(host + 'team/' + id + apiKey + ((filters) ? '&' + qs.stringify(filters) : '')); | ||
apiRequest(host + 'teams/' + id + apiKey + ((filters) ? '&' + qs.stringify(filters) : '')); | ||
}; | ||
@@ -46,3 +47,3 @@ | ||
this.get.club = function(id, filters) { | ||
apiRequest(host + 'club/' + id + apiKey + ((filters) ? '&' + qs.stringify(filters) : '')); | ||
apiRequest(host + 'clubs/' + id + apiKey + ((filters) ? '&' + qs.stringify(filters) : '')); | ||
}; | ||
@@ -57,5 +58,9 @@ | ||
this.get.match = function(id, filters) { | ||
apiRequest(host + 'match/' + id + apiKey + ((filters) ? '&' + qs.stringify(filters) : '')); | ||
apiRequest(host + 'matches/' + id + apiKey + ((filters) ? '&' + qs.stringify(filters) : '')); | ||
}; | ||
this.get.player_season_stats = function(id, filters) { | ||
apiRequest(host + 'player_season_stats' + ((id) ? '/' + id : '') + apiKey + ((filters) ? '&' + qs.stringify(filters) : '')); | ||
}; | ||
apiRequest = function(url){ | ||
@@ -65,4 +70,2 @@ var response = request(url); | ||
return response.then(function(response){return response;}); | ||
}; | ||
@@ -69,0 +72,0 @@ }; |
{ | ||
"name": "kimono-worldcup-api-wrapper", | ||
"description": "World Cup API Wrapper", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"homepage": "https://github.com/alexdibattista/kimono-worldcup-api", | ||
@@ -6,0 +6,0 @@ "main": "lib/kimono-worldcup-api", |
@@ -1,4 +0,76 @@ | ||
kimono-worldcup-api | ||
=================== | ||
#kimono-worldcup-api-wrapper | ||
npm package for Kimono World Cup API | ||
npm API wrapper for [Kimono World Cup API ](http://www.kimonolabs.com/worldcup/explorer) | ||
##Usage | ||
```node | ||
//Include the package | ||
var worldCup = require('kimono-worldcup-api-wrapper'); | ||
//Initialize with API Key | ||
var worldCupApi = worldCup('*** Kimono API Key***'); | ||
worldCupApi.get.players().done(function(res){ | ||
console.log(res); | ||
}); | ||
``` | ||
##Endpoints | ||
###Players | ||
worldCupApi.get.Players(filters) | ||
- Takes Optional filters (ie '{ sort : position }') | ||
- Returns a promise with the API response | ||
```node | ||
worldCupApi.get.players().done(function(res){ | ||
console.log(res); | ||
}); | ||
``` | ||
###Player | ||
worldCupApi.get.Player(id, filters) | ||
- Required player ID | ||
- Takes Optional filters (ie '{ sort : position }') | ||
- Returns a promise with the API response | ||
```node | ||
worldCupApi.get.player('** players ID**').done(function(res){ | ||
console.log(res); | ||
}); | ||
``` | ||
###Teams | ||
worldCupApi.get.Teams(filters) | ||
- Takes Optional filters (ie '{ sort : position }') | ||
- Returns a promise with the API response | ||
```node | ||
worldCupApi.get.players().done(function(res){ | ||
console.log(res); | ||
}); | ||
``` | ||
###Team | ||
worldCupApi.get.Team(id, filters) | ||
- Required Team ID | ||
- Takes Optional filters (ie '{ sort : position }') | ||
- Returns a promise with the API response | ||
```node | ||
worldCupApi.get.Teams().done(function(res){ | ||
console.log(res); | ||
}); | ||
``` | ||
###Matches | ||
worldCupApi.get.Matches(filters) | ||
- Takes Optional filters (ie '{ sort : position }') | ||
- Returns a promise with the API response | ||
###Match | ||
worldCupApi.get.Match(id, filters) | ||
- Required Match ID | ||
- Takes Optional filters (ie '{ sort : position }') | ||
- Returns a promise with the API response | ||
##Filters | ||
5494
54
77