summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-25 11:09:09 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-26 23:35:14 -0400
commit40939795096c0b7a1791d71d920b84ff283fb550 (patch)
treecb461881b1a84c337ebc9b3f325561dc8bdef95f /app/controllers
parent4638a832b3b9da87bf076f4370e0d99bdf11ee78 (diff)
Sampling methods WIP
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/users_controller.rb15
1 files changed, 1 insertions, 14 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 27b3c61..767d992 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -62,20 +62,7 @@ class UsersController < ApplicationController
else
params[:user][:remote_usernames].each do |game_name,user_name|
game = Game.find_by_name(game_name)
- remote_username = HTTParty.get("https://prod.api.pvp.net/api/lol/na/v1.3/summoner/by-name/#{user_name.downcase}?api_key=ad539f86-22fd-474d-9279-79a7a296ac38")
-
- id = "#{remote_username["#{user_name.downcase}"]["id"]}".to_i
- username = "#{remote_username["#{user_name.downcase}"]["name"]}"
-
- hash = {:username => username, :id => id}
-
- remote = @user.remote_usernames.where(:game => game).first
- if remote.nil?
- ok &= @user.remote_usernames.create(game: game, value: hash)
- else
- remote.value = hash
- ok &= remote.save
- end
+ Sampling::RiotApi::set_remote_name(@user, game, user_name)
end
end
respond_to do |format|