summaryrefslogtreecommitdiff
path: root/app/controllers/matches_controller.rb
diff options
context:
space:
mode:
authortkimia <tkimia@purdue.edu>2014-04-24 16:20:32 -0400
committertkimia <tkimia@purdue.edu>2014-04-24 16:20:32 -0400
commitcb9ab169f9d3e650deef23841c3e70bc62cbca34 (patch)
tree0261aa3bab4eca19dcf8cfcd11aefc7e48972bf9 /app/controllers/matches_controller.rb
parent66aed81910ba84e829ecc9c0d11bed104c4283d0 (diff)
parent62780a89fb04e1d96c3bbc8c8dd2db9efdc656f1 (diff)
Merge branch 'master' of https://github.com/LukeShu/leaguer
I've been updating the SVG to work for all team_nums in elimination
Diffstat (limited to 'app/controllers/matches_controller.rb')
-rw-r--r--app/controllers/matches_controller.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb
index 59b354d..1ad86d0 100644
--- a/app/controllers/matches_controller.rb
+++ b/app/controllers/matches_controller.rb
@@ -17,6 +17,45 @@ class MatchesController < ApplicationController
end
def get_riot
+
+ players_id = Array.new
+ players = Array.new
+
+ @match.teams.each do |team|
+ team.users.each do |user|
+ players_id.push(user.remote_usernames[0]["json_value"]["id"])
+ players.push(user.remote_usernames[0]["json_value"]["id"])
+ end
+ end
+
+ recent = HTTParty.get("https://prod.api.pvp.net/api/lol/na/v1.3/game/by-summoner/#{players_id[0]}/recent?api_key=ad539f86-22fd-474d-9279-79a7a296ac38")
+
+ blue = Hash.new
+ purple = Hash.new
+
+ for i in 0..8
+ current_player = players_id[i]
+ place = players[i]
+ info = HTTParty.get("https://prod.api.pvp.net/api/lol/na/v1.3/game/by-summoner/#{current_player}/recent?api_key=ad539f86-22fd-474d-9279-79a7a296ac38")
+
+ if 100 == info["games"][0]["stats"]["team"]
+ blue.merge!("#{place}" => info["games"][0]["stats"])
+ else
+ purple.merge!("#{place}" => info["games"][0]["stats"])
+ end
+ sleep(1)
+ end
+
+ #look into this glitch
+ if 100 == recent["games"][0]["stats"]["team"]
+ blue.merge!("#{players[9]}" => recent["games"][0]["stats"])
+ else
+ purple.merge!("#{players[9]}" => recent["games"][0]["stats"])
+ end
+
+ @purp = purple
+ @blue = blue
+
end
def get_riot_info_fake