demacia 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/Demacia.rb +7 -0
  2. data/lib/demacia/Summoner.rb +9 -2
  3. metadata +1 -1
@@ -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
@@ -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 get_last_ten_games(key)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: demacia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: