class RiotLolApi::Model::Summoner

Constants

SEASON_TAB

attr needs @id, @region

Public Instance Methods

current_game(platform_id = 'EUW1') click to toggle source
# File lib/riot_lol_api/models/summoners.rb, line 99
def current_game(platform_id = 'EUW1')
  response = @client.get(url: "observer-mode/rest/consumer/getSpectatorGameInfo/#{platform_id}/#{@id}", domaine: @region, overide_base_uri: 'api.pvp.net/')
  return nil if response.nil?
  RiotLolApi::Model::Game.new(response.lol_symbolize)
end
games() click to toggle source
# File lib/riot_lol_api/models/summoners.rb, line 53
def games
  response = @client.get(url: "#{@region}/v1.3/game/by-summoner/#{@id}/recent", domaine: @region)
  return nil if response.nil?
  tab_games = []
  response['games'].each do |game|
    tab_games << RiotLolApi::Model::Game.new(game.lol_symbolize)
  end
  tab_games
end
get_league_stats() click to toggle source
# File lib/riot_lol_api/models/summoners.rb, line 83
def get_league_stats
  response = @client.get(url: "#{@region}/v2.5/league/by-summoner/#{@id}/entry", domaine: @region)
  return nil if response.nil?
  tab_league_stats = []
  response["#{@id}"].each do |league_stat|
    tab_league_stats << RiotLolApi::Model::League.new(league_stat.lol_symbolize)
  end
  tab_league_stats
end
masteries() click to toggle source
# File lib/riot_lol_api/models/summoners.rb, line 33
def masteries
  response = @client.get(url: "#{@region}/v1.4/summoner/#{@id}/masteries", domaine: @region)
  return nil if response.nil?
  tab_pages = []
  response[id.to_s]['pages'].each do |page|
    tab_pages << RiotLolApi::Model::Page.new(page.lol_symbolize)
  end
  tab_pages
end
match_list() click to toggle source
# File lib/riot_lol_api/models/summoners.rb, line 93
def match_list
  response = @client.get(url: "#{@region}/v2.2/matchlist/by-summoner/#{@id}", domaine: @region)
  return nil if response.nil?
  response['matches'].map { |match_history| RiotLolApi::Model::Match.new(match_history.lol_symbolize) }
end
profile_icon() click to toggle source
# File lib/riot_lol_api/models/summoners.rb, line 105
def profile_icon
  "#{RiotLolApi::Client.realm['cdn']}/#{RiotLolApi::Client.realm['v']}/img/profileicon/#{profile_icon_id}.png"
end
runes() click to toggle source
# File lib/riot_lol_api/models/summoners.rb, line 43
def runes
  response = @client.get(url: "#{@region}/v1.4/summoner/#{@id}/runes", domaine: @region)
  return nil if response.nil?
  tab_pages = []
  response[id.to_s]['pages'].each do |page|
    tab_pages << RiotLolApi::Model::Page.new(page.lol_symbolize)
  end
  tab_pages
end
stat_ranks(season = 'SEASON2015') click to toggle source
# File lib/riot_lol_api/models/summoners.rb, line 73
def stat_ranks(season = 'SEASON2015')
  response = @client.get(url: "#{@region}/v1.3/stats/by-summoner/#{@id}/ranked", domaine: @region, data: { season: season })
  return nil if response.nil?
  tab_stat_ranks = []
  response['champions'].each do |stat_rank|
    tab_stat_ranks << RiotLolApi::Model::PlayerStatRank.new(stat_rank.lol_symbolize)
  end
  tab_stat_ranks
end
stat_summaries(season = 'SEASON2015') click to toggle source
# File lib/riot_lol_api/models/summoners.rb, line 63
def stat_summaries(season = 'SEASON2015')
  response = @client.get(url: "#{@region}/v1.3/stats/by-summoner/#{@id}/summary", domaine: @region, data: { season: season })
  return nil if response.nil?
  tab_stat_summaries = []
  response['playerStatSummaries'].each do |stat_summary|
    tab_stat_summaries << RiotLolApi::Model::PlayerStatSummary.new(stat_summary.lol_symbolize)
  end
  tab_stat_summaries
end