demacia 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/Demacia.rb +7 -0
- data/lib/demacia/Summoner.rb +9 -2
- metadata +1 -1
data/lib/Demacia.rb
CHANGED
@@ -33,5 +33,12 @@ module Demacia
|
|
33
33
|
def summoner_by_id(id)
|
34
34
|
summoner = Demacia::Summoner.new(@entry_point+"summoner/"+id+@api_suffix, @region)
|
35
35
|
end
|
36
|
+
|
37
|
+
# Gets the list of all league of legends champions
|
38
|
+
# Params:
|
39
|
+
# +id+:: The summoner id from riot's api
|
40
|
+
def champions
|
41
|
+
|
42
|
+
end
|
36
43
|
end
|
37
44
|
end
|
data/lib/demacia/Summoner.rb
CHANGED
@@ -5,6 +5,7 @@ require 'Page'
|
|
5
5
|
require 'Talent'
|
6
6
|
require 'Rune'
|
7
7
|
require 'Tome'
|
8
|
+
require 'Game'
|
8
9
|
|
9
10
|
module Demacia
|
10
11
|
class Summoner
|
@@ -72,9 +73,15 @@ module Demacia
|
|
72
73
|
end
|
73
74
|
end
|
74
75
|
|
75
|
-
def
|
76
|
-
answer_string = open("http://prod.api.pvp.net/api/lol/" + @region +"/v1.1/game/by-summoner"+@id.to_s+"/recent?api_key="+key).read
|
76
|
+
def last_ten_games(key)
|
77
|
+
answer_string = open("http://prod.api.pvp.net/api/lol/" + @region +"/v1.1/game/by-summoner/"+@id.to_s+"/recent?api_key="+key).read
|
77
78
|
parsed_answer = JSON.parse(answer_string)
|
79
|
+
games = Array.new
|
80
|
+
parsed_answer["games"].each do |game|
|
81
|
+
game_buffer = Game.new(game["gameId"],game["championId"],game["createDate"], game["fellowPlayers"], game["gameMode"], game["gameType"], game["invalid"], game["level"], game["mapId"], game["spell1"], game["spell2"], game["statistics"], game["subType"], game["teamId"])
|
82
|
+
games << game_buffer
|
83
|
+
end
|
84
|
+
games
|
78
85
|
end
|
79
86
|
|
80
87
|
# Prints the summoner info to the console in a friendly way
|