Created
August 2, 2015 03:59
-
-
Save danker/de3c976731ccb09af835 to your computer and use it in GitHub Desktop.
Groovy script that will pull stats on recent games for the specified SummonerID.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovyx.net.http.RESTClient | |
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.1' ) | |
def API_KEY = "INSERT-API-KEY-HERE" | |
def SUMMONER_ID = "28450305" | |
// FULL DOCUMENTATION AT: https://developer.riotgames.com/api/methods | |
def client = new RESTClient('https://na.api.pvp.net') | |
def RECENT_GAMES_PATH = "/api/lol/na/v1.3/game/by-summoner/" + SUMMONER_ID + "/recent" | |
def response = client.get(path:RECENT_GAMES_PATH, query:[api_key:API_KEY]) | |
def games = response.responseData.games | |
games.each { game -> | |
println("${new Date(game.createDate)}: ${game.gameType}/${game.subType} >> ${game.stats.win ? 'WIN':'LOSS'} - " | |
+ "${game.stats.championsKilled ? game.stats.championsKilled:0}/" | |
+ "${game.stats.numDeaths ? game.stats.numDeaths:0}/" | |
+ "${game.stats.assists ? game.stats.assists:0}") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment