Class: RiotLolApi::Model::Summoner
- Inherits:
-
Object
- Object
- RiotLolApi::Model::Summoner
- Includes:
- Concern::Init, HelperClass
- Defined in:
- lib/riot_lol_api/models/summoners.rb
Constant Summary collapse
- SEASON_TAB =
attr needs @id, @region
%(SEASON2016, SEASON2015, SEASON2014, SEASON3)
Instance Method Summary collapse
- #current_game(platform_id = 'EUW1') ⇒ Object
- #games ⇒ Object
- #get_league_stats ⇒ Object
- #masteries ⇒ Object
- #match_list ⇒ Object
- #profile_icon ⇒ Object
- #runes ⇒ Object
- #stat_ranks(season = 'SEASON2015') ⇒ Object
- #stat_summaries(season = 'SEASON2015') ⇒ Object
Methods included from Concern::Init
Methods included from HelperClass
Instance Method Details
#current_game(platform_id = 'EUW1') ⇒ Object
99 100 101 102 103 |
# 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 ⇒ Object
53 54 55 56 57 58 59 60 61 |
# 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 ⇒ Object
83 84 85 86 87 88 89 90 91 |
# 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 ⇒ Object
33 34 35 36 37 38 39 40 41 |
# 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 ⇒ Object
93 94 95 96 97 |
# 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 ⇒ Object
105 106 107 |
# 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 ⇒ Object
43 44 45 46 47 48 49 50 51 |
# 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') ⇒ Object
73 74 75 76 77 78 79 80 81 |
# 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') ⇒ Object
63 64 65 66 67 68 69 70 71 |
# 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 |