diff options
author | nfoy <nfoy@purdue.edu> | 2014-04-07 12:53:36 -0400 |
---|---|---|
committer | nfoy <nfoy@purdue.edu> | 2014-04-07 12:53:36 -0400 |
commit | 677f914b0d1c9cefcbd9aacbd48e83ab98916f8f (patch) | |
tree | bd12d4f6433a28134bcb8d022f35b48cdde3108d /app/controllers/matches_controller.rb | |
parent | a35fa838565d08d0c6394b943b8fe54b0e56a25e (diff) |
Moved and updated the not-working asynchronous API auto-update feature.
Diffstat (limited to 'app/controllers/matches_controller.rb')
-rw-r--r-- | app/controllers/matches_controller.rb | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index 69ea23b..53f9f47 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -123,35 +123,6 @@ class MatchesController < ApplicationController # GET /matches/1 # GET /matches/1.json - def is_match_over - response = HTTParty.get("https://prod.api.pvp.net/api/lol/na/v1.3/summoner/by-name/#{@first}?api_key=ad539f86-22fd-474d-9279-79a7a296ac38") - riot_id = response["#{@first}"]['id'] - #recent game information - game_info = HTTParty.get("https://prod.api.pvp.net/api/lol/na/v1.3/game/by-summoner/#{riot_id}/recent?api_key=ad539f86-22fd-474d-9279-79a7a296ac38") - first_id = game_info["games"][0]["gameId"] - - while true do - sleep(240) #wait four minutes - - recent = HTTParty.get("https://prod.api.pvp.net/api/lol/na/v1.3/game/by-summoner/#{riot_id}/recent?api_key=ad539f86-22fd-474d-9279-79a7a296ac38") - current_id = recent["games"][0]["gameId"] - - if current_id != first_id - @match.status = 2 - end - end #while - end - handle_asynchronously :is_match_over - - def show - if Tournament.find_by_id(@match.tournament_id).game_id == 1 - file_blue = "blue.yaml" - file_purple = "purple.yaml" - @blue2 = YAML.load_file(file_blue) - @purp2 = YAML.load_file(file_purple) - end - end - def update case params[:update_action] when "start" |