sightstone 1.4.2 → 1.4.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 38279a7f1b4ec4691e88ed7fb2ac5cefebeca985
4
- data.tar.gz: b2498dc2fc739ae1729e17b1bfabb712c91b4b75
3
+ metadata.gz: 674b8ccfe9635887055e21b15151ee42e3bc6f98
4
+ data.tar.gz: 3ee4495da48ce5b376a699dd2ead22d4943536c1
5
5
  SHA512:
6
- metadata.gz: 76132725fa1f45fdaafddbebf2cc527084d7afc1463a9e20dfdc674fd8ee6b762551b2d3cb02cadba79b0888a4d5f480bd2a70f4dd01c26e73f46f73407d3303
7
- data.tar.gz: 22137135214f309482ec30867cca98d3df6fbf8da76c2da6ec1f9c417b70bec980be0fc4c828f94328dbd1df0907225b973a2e3a36c7c65b9dd425b81662adbf
6
+ metadata.gz: 0cb27f775a73026f9e901199d5afd13443b2276adfa96710f48244e670875dd845a805c5ab2f8f857e379e7bae7278a2df09f969859750c9a333b93e518238ba
7
+ data.tar.gz: 23a6a7e7f763555c2dd3556c44aa3e214adc6a19c75b0b92e1c0d79c5628fc7ddf29bfa25ef6ba0d8488515321a00b9a8f6594e3922a50f3642ba4e8e65684b7
data/lib/sightstone.rb CHANGED
@@ -1,60 +1,60 @@
1
- require 'rest_client'
2
- require 'json'
3
- require 'sightstone/modules/champion_module'
4
- require 'sightstone/modules/summoner_module'
5
- require 'sightstone/modules/game_module'
6
- require 'sightstone/modules/league_module'
7
- require 'sightstone/modules/stats_module'
8
- require 'sightstone/modules/team_module'
9
- require 'sightstone/modules/datadragon_module'
10
-
11
- # This is the main class of the Sightstone gem. All calls should be perfomrmed through this class.
12
- # @attr [String] region The default region
13
- # @attr [String] api_key Your api key
14
- # @attr [SummonerModule] summoner Module to call the summoners api
15
- # @attr [ChampionModule] Champion module to call the champion api
16
- # @attr [GameModule] Game module to call the game api
17
- # @attr [LeagueModule] League module to call the leagues api
18
- # @attr [StatsModule] Stats module to call the stats api
19
- # @attr [TeamModule] Team module to call the team api
20
- module Sightstone
21
-
22
- class Sightstone
23
-
24
- attr_accessor :region
25
- attr_accessor :api_key
26
- attr_accessor :summoner, :champion, :game, :league, :stats, :team, :ddragon
27
-
28
- # @param api_key [String] Riot developer api key
29
- # @param region [String] The default region to be used. See riots dev. page for supported regions.
30
- def initialize(api_key, region='euw')
31
- @api_key = api_key
32
- @region = region
33
-
34
- @summoner = SummonerModule.new(self)
35
- @champion = ChampionModule.new(self)
36
- @game = GameModule.new(self)
37
- @league = LeagueModule.new(self)
38
- @stats = StatsModule.new(self)
39
- @team = TeamModule.new(self)
40
- @ddragon = DatadragonModule.new(self)
41
- end
42
- end
43
-
44
- # Base class for exceptions raised by the gem
45
- class SightstoneApiException < Exception; end
46
-
47
- # Raised if no or an invalid api key was passed to the api
48
- class InvalidApiKeyException < SightstoneApiException; end
49
-
50
- # Raised if the given developer cannot be found (api returns http error code 404)
51
- class SummonerNotFoundException < SightstoneApiException; end
52
-
53
- # Raised if the connection to the api failed
54
- class SightstoneConnectionException < SightstoneApiException; end
55
-
56
- # Raised when the RateLimit has been exceeded (api returns http error code 429)
57
- class RateLimitExceededException < SightstoneApiException; end
58
-
59
-
60
- end
1
+ require 'rest_client'
2
+ require 'json'
3
+ require 'sightstone/modules/champion_module'
4
+ require 'sightstone/modules/summoner_module'
5
+ require 'sightstone/modules/game_module'
6
+ require 'sightstone/modules/league_module'
7
+ require 'sightstone/modules/stats_module'
8
+ require 'sightstone/modules/team_module'
9
+ require 'sightstone/modules/datadragon_module'
10
+
11
+ # This is the main class of the Sightstone gem. All calls should be perfomrmed through this class.
12
+ # @attr [String] region The default region
13
+ # @attr [String] api_key Your api key
14
+ # @attr [SummonerModule] summoner Module to call the summoners api
15
+ # @attr [ChampionModule] Champion module to call the champion api
16
+ # @attr [GameModule] Game module to call the game api
17
+ # @attr [LeagueModule] League module to call the leagues api
18
+ # @attr [StatsModule] Stats module to call the stats api
19
+ # @attr [TeamModule] Team module to call the team api
20
+ module Sightstone
21
+
22
+ class Sightstone
23
+
24
+ attr_accessor :region
25
+ attr_accessor :api_key
26
+ attr_accessor :summoner, :champion, :game, :league, :stats, :team, :ddragon
27
+
28
+ # @param api_key [String] Riot developer api key
29
+ # @param region [String] The default region to be used. See riots dev. page for supported regions.
30
+ def initialize(api_key, region='euw')
31
+ @api_key = api_key
32
+ @region = region
33
+
34
+ @summoner = SummonerModule.new(self)
35
+ @champion = ChampionModule.new(self)
36
+ @game = GameModule.new(self)
37
+ @league = LeagueModule.new(self)
38
+ @stats = StatsModule.new(self)
39
+ @team = TeamModule.new(self)
40
+ @ddragon = DatadragonModule.new(self)
41
+ end
42
+ end
43
+
44
+ # Base class for exceptions raised by the gem
45
+ class SightstoneApiException < Exception; end
46
+
47
+ # Raised if no or an invalid api key was passed to the api
48
+ class InvalidApiKeyException < SightstoneApiException; end
49
+
50
+ # Raised if the given developer cannot be found (api returns http error code 404)
51
+ class SummonerNotFoundException < SightstoneApiException; end
52
+
53
+ # Raised if the connection to the api failed
54
+ class SightstoneConnectionException < SightstoneApiException; end
55
+
56
+ # Raised when the RateLimit has been exceeded (api returns http error code 429)
57
+ class RateLimitExceededException < SightstoneApiException; end
58
+
59
+
60
+ end
@@ -1,32 +1,32 @@
1
- module Sightstone
2
- # Class to represent a champion
3
- # @attr [Boolean] active determines if champion is active
4
- # @attr [Integer] attackRank attack rank
5
- # @attr [Boolean] botEnabled Bot enabled flag (for custom games)
6
- # @attr [Boolean] botMmEnabled Bot Match Made enabeld flag (for Coop/AI games)
7
- # @attr [Integer] defenseRank Champion defense rank.
8
- # @attr [Integer] difficultyRank Champion difficulty rank.
9
- # @attr [Boolean] freeToPlay Indicates if the champion is free to play. Free to play champions are rotated periodically.
10
- # @attr [Fixnum] id Champion ID.
11
- # @attr [Integer] magicRank Champion magic rank.
12
- # @attr [String] name Champion name.
13
- # @attr [boolean] rankedPlayEnabled Ranked play enabled flag.
14
- class Champion
15
- attr_accessor :active, :attackRank, :botEnabled, :botMmEnabled
16
- attr_accessor :defenseRank, :difficultyRank, :freeToPlay, :id, :magicRank, :name, :rankedPlayEnabled
17
-
18
- def initialize(data)
19
- @active = data['active']
20
- @attackRank = data['attackRank']
21
- @botEnabled = data['botEnabled']
22
- @defenseRank = data['defenseRank']
23
- @difficultyRank = data['difficultyRank']
24
- @freeToPlay = data['freeToPlay']
25
- @id = data['id']
26
- @magicRank = data['magicRank']
27
- @name = data['name']
28
- @rankedPlayEnabled = data['rankedPlayEnabled']
29
- end
30
-
31
- end
1
+ module Sightstone
2
+ # Class to represent a champion
3
+ # @attr [Boolean] active determines if champion is active
4
+ # @attr [Integer] attackRank attack rank
5
+ # @attr [Boolean] botEnabled Bot enabled flag (for custom games)
6
+ # @attr [Boolean] botMmEnabled Bot Match Made enabeld flag (for Coop/AI games)
7
+ # @attr [Integer] defenseRank Champion defense rank.
8
+ # @attr [Integer] difficultyRank Champion difficulty rank.
9
+ # @attr [Boolean] freeToPlay Indicates if the champion is free to play. Free to play champions are rotated periodically.
10
+ # @attr [Fixnum] id Champion ID.
11
+ # @attr [Integer] magicRank Champion magic rank.
12
+ # @attr [String] name Champion name.
13
+ # @attr [boolean] rankedPlayEnabled Ranked play enabled flag.
14
+ class Champion
15
+ attr_accessor :active, :attackRank, :botEnabled, :botMmEnabled
16
+ attr_accessor :defenseRank, :difficultyRank, :freeToPlay, :id, :magicRank, :name, :rankedPlayEnabled
17
+
18
+ def initialize(data)
19
+ @active = data['active']
20
+ @attackRank = data['attackRank']
21
+ @botEnabled = data['botEnabled']
22
+ @defenseRank = data['defenseRank']
23
+ @difficultyRank = data['difficultyRank']
24
+ @freeToPlay = data['freeToPlay']
25
+ @id = data['id']
26
+ @magicRank = data['magicRank']
27
+ @name = data['name']
28
+ @rankedPlayEnabled = data['rankedPlayEnabled']
29
+ end
30
+
31
+ end
32
32
  end
@@ -1,73 +1,74 @@
1
- module Sightstone
2
- # Class to represent a league
3
- # @attr [String] name name of the league
4
- # @attr [String] queue queue Type (can be: RANKED_SOLO_5x5, RANKED_TEAM_3x3, RANKED_TEAM_5x5)
5
- # @attr [String] tier tier of the requestet summoner (can be: CHALLENGER, DIAMOND, PLATINUM, GOLD, SILVER, BRONZE)
6
- # @attr [Array<LeagueItem>] entries
7
- class League
8
- attr_accessor :entries, :name, :queue, :tier
9
-
10
- def initialize(data)
11
- @name = data['name']
12
- @queue = data['queue']
13
- @tier = data['tier']
14
- @entries = []
15
- data['entries'].each do |entry|
16
- @entries << LeagueItem.new(entry)
17
- end
18
- end
19
- end
20
-
21
- # One entry of a league
22
- # @attr [Boolean] isFreshBlood determines if summoner is new in the league
23
- # @attr [Boolean] isHotStreak hotStreak = 3 games won in a row
24
- # @attr [Boolean] isInactive true if summoner is inactive
25
- # @attr [Boolean] isVetern true if veteran
26
- # @attr [Fixnum] lastPlayed timestamp of last played game
27
- # @attr [String] leagueName name of the league
28
- # @attr [Fixnum] leaguePoints leaguePoints
29
- # @attr [MiniSeries, nil] nil if player has no miniseries, a miniseries object if he is in one
30
- # @attr [String] playerOrTeamId id of the player or team as a string
31
- # @attr [String] playerOrTeamName name of the player/team
32
- # @attr [String] queueType type of the queue
33
- # @attr [String] rank rank (can be: I, II, III, IV, V)
34
- # @attr [String] tier tier (can be: CHALLENGER, DIAMOND, PLATINUM, GOLD, SILVER, BRONZE)
35
- # @attr [Fixnum] wins number of won matches in given queue
36
- class LeagueItem
37
- attr_accessor :isFreshBlood, :isHotStreak, :isInactive, :isVeteran, :lastPlayed, :leagueName, :leaguePoints, :miniSeries, :playerOrTeamId, :playerOrTeamName, :queueType, :rank, :tier, :wins
38
-
39
- def initialize(data)
40
- @isFreshBlood=data['isFreshBlood']
41
- @isHotStreak=data['isHotStreak']
42
- @isInactive=data['isInactive']
43
- @isVeteran=data['isVeteran']
44
- @lastPlayed=data['lastPlayed']
45
- @leagueName=data['leagueName']
46
- @leaguePoints=data['leaguePoints']
47
- @miniSeries= MiniSeries.new(data['miniSeries']) if data.has_key? 'miniSeries'
48
- @playerOrTeamId=data['playerOrTeamId']
49
- @playerOrTeamName=data['playerOrTeamName']
50
- @queueType=data['queueType']
51
- @rank=data['rank']
52
- @tier=data['tier']
53
- @wins=data['wins']
54
- end
55
- end
56
-
57
- # Class to represent a MiniSeries (Promotion games)
58
- # @attr [Fixnum] losses number of lost games of the series
59
- # @attr [Fixnum] wins number of won games of the series
60
- # @attr [Fixnum] target number of required wins to win the series
61
- # @attr [Fixnum] timeLeftToPlayMillis time left to complete the series
62
- # @attr [String] win/loose history as a string. Each character shows a (W)in, (L)oss or (N)ot played
63
- class MiniSeries
64
- attr_accessor :losses, :wins, :target, :progress, :timeLeftToPlayMillis
65
- def initialize(data)
66
- @losses = data['losses']
67
- @wins = data['wins']
68
- @target = data['target']
69
- @progress = data['progress']
70
- @timeLeftToPlayMillis = data['timeLeftToPlayMillis']
71
- end
72
- end
73
- end
1
+ module Sightstone
2
+ # Class to represent a league
3
+ # @attr [String] name name of the league
4
+ # @attr [String] queue queue Type (can be: RANKED_SOLO_5x5, RANKED_TEAM_3x3, RANKED_TEAM_5x5)
5
+ # @attr [String] tier tier of the requestet summoner (can be: CHALLENGER, DIAMOND, PLATINUM, GOLD, SILVER, BRONZE)
6
+ # @attr [Array<LeagueItem>] entries
7
+ class League
8
+ attr_accessor :entries, :name, :queue, :tier, :participantId
9
+
10
+ def initialize(data)
11
+ @name = data['name']
12
+ @queue = data['queue']
13
+ @tier = data['tier']
14
+ @participantId = data['participantId']
15
+ @entries = []
16
+ data['entries'].each do |entry|
17
+ @entries << LeagueItem.new(entry)
18
+ end
19
+ end
20
+ end
21
+
22
+ # One entry of a league
23
+ # @attr [Boolean] isFreshBlood determines if summoner is new in the league
24
+ # @attr [Boolean] isHotStreak hotStreak = 3 games won in a row
25
+ # @attr [Boolean] isInactive true if summoner is inactive
26
+ # @attr [Boolean] isVetern true if veteran
27
+ # @attr [Fixnum] lastPlayed timestamp of last played game
28
+ # @attr [String] leagueName name of the league
29
+ # @attr [Fixnum] leaguePoints leaguePoints
30
+ # @attr [MiniSeries, nil] nil if player has no miniseries, a miniseries object if he is in one
31
+ # @attr [String] playerOrTeamId id of the player or team as a string
32
+ # @attr [String] playerOrTeamName name of the player/team
33
+ # @attr [String] queueType type of the queue
34
+ # @attr [String] rank rank (can be: I, II, III, IV, V)
35
+ # @attr [String] tier tier (can be: CHALLENGER, DIAMOND, PLATINUM, GOLD, SILVER, BRONZE)
36
+ # @attr [Fixnum] wins number of won matches in given queue
37
+ class LeagueItem
38
+ attr_accessor :isFreshBlood, :isHotStreak, :isInactive, :isVeteran, :lastPlayed, :leagueName, :leaguePoints, :miniSeries, :playerOrTeamId, :playerOrTeamName, :queueType, :rank, :tier, :wins
39
+
40
+ def initialize(data)
41
+ @isFreshBlood=data['isFreshBlood']
42
+ @isHotStreak=data['isHotStreak']
43
+ @isInactive=data['isInactive']
44
+ @isVeteran=data['isVeteran']
45
+ @lastPlayed=data['lastPlayed']
46
+ @leagueName=data['leagueName']
47
+ @leaguePoints=data['leaguePoints']
48
+ @miniSeries= MiniSeries.new(data['miniSeries']) if data.has_key? 'miniSeries'
49
+ @playerOrTeamId=data['playerOrTeamId']
50
+ @playerOrTeamName=data['playerOrTeamName']
51
+ @queueType=data['queueType']
52
+ @rank=data['rank']
53
+ @tier=data['tier']
54
+ @wins=data['wins']
55
+ end
56
+ end
57
+
58
+ # Class to represent a MiniSeries (Promotion games)
59
+ # @attr [Fixnum] losses number of lost games of the series
60
+ # @attr [Fixnum] wins number of won games of the series
61
+ # @attr [Fixnum] target number of required wins to win the series
62
+ # @attr [Fixnum] timeLeftToPlayMillis time left to complete the series
63
+ # @attr [String] win/loose history as a string. Each character shows a (W)in, (L)oss or (N)ot played
64
+ class MiniSeries
65
+ attr_accessor :losses, :wins, :target, :progress, :timeLeftToPlayMillis
66
+ def initialize(data)
67
+ @losses = data['losses']
68
+ @wins = data['wins']
69
+ @target = data['target']
70
+ @progress = data['progress']
71
+ @timeLeftToPlayMillis = data['timeLeftToPlayMillis']
72
+ end
73
+ end
74
+ end
@@ -1,50 +1,50 @@
1
- module Sightstone
2
- # Class to represent the masterybook of a summoner
3
- # @attr [Numeric] summonerId id of the summoner
4
- # @attr [Array<MasteryPage>] pages of the masterybook
5
- class MasteryBook
6
- attr_accessor :pages, :summonerId
7
-
8
- def initialize(data)
9
- @summonerId = data['summonerId']
10
- @pages = []
11
- data['pages'].each do |page|
12
- @pages << MasteryPage.new(page)
13
- end
14
- end
15
- end
16
-
17
- # Class to represent a page of a masterybook
18
- # @attr [Numeric] id ID of the page
19
- # @attr [String] name page name
20
- # @attr [Boolean] current indicates if the page is selected
21
- # @attr [Array<Talent>] array of selected talents
22
- class MasteryPage
23
- attr_accessor :id, :talents, :name, :current
24
-
25
- def initialize(data)
26
- @id = data['id']
27
- @name = data['name']
28
- @current = data['current']
29
- @talents = []
30
- data['talents'].each do |talent|
31
- @talents << Talent.new(talent)
32
- end
33
- end
34
-
35
- end
36
-
37
- # Class to represent a talent of a mastery page
38
- # @attr [Numeric] id id of the mastery
39
- # @attr [String] name of the mastery
40
- # @attr [Numeric] rank rank of the mastery
41
- class Talent
42
- attr_accessor :id,:rank, :name
43
-
44
- def initialize(data)
45
- @id = data['id']
46
- @name = data['name']
47
- @rank = data['rank']
48
- end
49
- end
1
+ module Sightstone
2
+ # Class to represent the masterybook of a summoner
3
+ # @attr [Numeric] summonerId id of the summoner
4
+ # @attr [Array<MasteryPage>] pages of the masterybook
5
+ class MasteryBook
6
+ attr_accessor :pages, :summonerId
7
+
8
+ def initialize(data)
9
+ @summonerId = data['summonerId']
10
+ @pages = []
11
+ data['pages'].each do |page|
12
+ @pages << MasteryPage.new(page)
13
+ end
14
+ end
15
+ end
16
+
17
+ # Class to represent a page of a masterybook
18
+ # @attr [Numeric] id ID of the page
19
+ # @attr [String] name page name
20
+ # @attr [Boolean] current indicates if the page is selected
21
+ # @attr [Array<Talent>] array of selected talents
22
+ class MasteryPage
23
+ attr_accessor :id, :talents, :name, :current
24
+
25
+ def initialize(data)
26
+ @id = data['id']
27
+ @name = data['name']
28
+ @current = data['current']
29
+ @talents = []
30
+ data['talents'].each do |talent|
31
+ @talents << Talent.new(talent)
32
+ end
33
+ end
34
+
35
+ end
36
+
37
+ # Class to represent a talent of a mastery page
38
+ # @attr [Numeric] id id of the mastery
39
+ # @attr [String] name of the mastery
40
+ # @attr [Numeric] rank rank of the mastery
41
+ class Talent
42
+ attr_accessor :id,:rank, :name
43
+
44
+ def initialize(data)
45
+ @id = data['id']
46
+ @name = data['name']
47
+ @rank = data['rank']
48
+ end
49
+ end
50
50
  end
@@ -1,76 +1,76 @@
1
- module Sightstone
2
- # match history of a summoner
3
- # @attr [Fixnum] summonerId ID of the summoner
4
- # @attr [Array<HistoryGame>] games unsorted list of recently played games
5
- class MatchHistory
6
- attr_accessor :games, :summonerId
7
-
8
- def initialize(data)
9
- @summonerId = data['summonerId']
10
- @games = []
11
- data['games'].each do |game|
12
- games << HistoryGame.new(game)
13
- end
14
- end
15
- end
16
-
17
- # A played game
18
- # @attr [Fixnum] championId ID of the played champ of requested summoner
19
- # @attr [Fixnum] createDate UNIX timestamp of creation date of the games
20
- # @attr [Array<Player>] fellowPlayers a list of all players of the game
21
- # @attr [Fixnum] gameId ID of the game
22
- # @attr [String] gameMode mode of the game
23
- # @attr [String] gameType type of the game
24
- # @attr [Boolean] invalid Invalid flag #TODO what is this?
25
- # @attr [Fixnum] level level of the requested summoner
26
- # @attr [Fixnum] mapId ID of the played map
27
- # @attr [Fixnum] spell1 selected summoner spell no 1
28
- # @attr [Fixnum] spell2 selected summoner spell no 2
29
- # @attr [String] subtype subtype
30
- # @attr [Fixnum] teamId ID of the team if there is a team associated to the game
31
- # @attr [Hash<String, Fixnum, Boolean>] statistics statistics of the game as a Hash: name -> value
32
- class HistoryGame
33
- attr_accessor :championId, :createDate, :fellowPlayers, :gameId, :gameMode, :gameType, :invalid, :level, :mapId, :spell1, :spell2, :statistics, :subType, :teamId
34
-
35
- def initialize(data)
36
- @championId=data['championId']
37
- @createDate=data['createDate']
38
- @createDateString=data['createDateString']
39
- @fellowPlayers=[]
40
- if(data.has_key? "fellowPlayers")
41
- data['fellowPlayers'].each do |player|
42
- @fellowPlayers << Player.new(player)
43
- end
44
- end
45
- @gameId=data['gameId']
46
- @gameMode=data['gameMode']
47
- @gameType=data['gameType']
48
- @invalid=data['invalid']
49
- @level=data['level']
50
- @mapId=data['mapId']
51
- @spell1=data['spell1']
52
- @spell2=data['spell2']
53
- @statistics = {}
54
- data['stats'].each do |key, stat|
55
- @statistics[key] = stat
56
- end
57
- @subType=data['subType']
58
- @teamId=data['teamId']
59
- end
60
- end
61
-
62
- # player of a game
63
- # @attr [Fixnum] championId ID of played Champion
64
- # @attr [Fixnum] summonerId ID of the summoner
65
- # @attr [Fixnum] teammId ID of the team
66
- class Player
67
- attr_accessor :championId, :summonerId, :teamId
68
-
69
- def initialize(data)
70
- @championId = data['championId']
71
- @summonerId = data['summonerId']
72
- @teamId = data['teamId']
73
- end
74
- end
75
-
76
- end
1
+ module Sightstone
2
+ # match history of a summoner
3
+ # @attr [Fixnum] summonerId ID of the summoner
4
+ # @attr [Array<HistoryGame>] games unsorted list of recently played games
5
+ class MatchHistory
6
+ attr_accessor :games, :summonerId
7
+
8
+ def initialize(data)
9
+ @summonerId = data['summonerId']
10
+ @games = []
11
+ data['games'].each do |game|
12
+ games << HistoryGame.new(game)
13
+ end
14
+ end
15
+ end
16
+
17
+ # A played game
18
+ # @attr [Fixnum] championId ID of the played champ of requested summoner
19
+ # @attr [Fixnum] createDate UNIX timestamp of creation date of the games
20
+ # @attr [Array<Player>] fellowPlayers a list of all players of the game
21
+ # @attr [Fixnum] gameId ID of the game
22
+ # @attr [String] gameMode mode of the game
23
+ # @attr [String] gameType type of the game
24
+ # @attr [Boolean] invalid Invalid flag #TODO what is this?
25
+ # @attr [Fixnum] level level of the requested summoner
26
+ # @attr [Fixnum] mapId ID of the played map
27
+ # @attr [Fixnum] spell1 selected summoner spell no 1
28
+ # @attr [Fixnum] spell2 selected summoner spell no 2
29
+ # @attr [String] subtype subtype
30
+ # @attr [Fixnum] teamId ID of the team if there is a team associated to the game
31
+ # @attr [Hash<String, Fixnum, Boolean>] statistics statistics of the game as a Hash: name -> value
32
+ class HistoryGame
33
+ attr_accessor :championId, :createDate, :fellowPlayers, :gameId, :gameMode, :gameType, :invalid, :level, :mapId, :spell1, :spell2, :statistics, :subType, :teamId
34
+
35
+ def initialize(data)
36
+ @championId=data['championId']
37
+ @createDate=data['createDate']
38
+ @createDateString=data['createDateString']
39
+ @fellowPlayers=[]
40
+ if(data.has_key? "fellowPlayers")
41
+ data['fellowPlayers'].each do |player|
42
+ @fellowPlayers << Player.new(player)
43
+ end
44
+ end
45
+ @gameId=data['gameId']
46
+ @gameMode=data['gameMode']
47
+ @gameType=data['gameType']
48
+ @invalid=data['invalid']
49
+ @level=data['level']
50
+ @mapId=data['mapId']
51
+ @spell1=data['spell1']
52
+ @spell2=data['spell2']
53
+ @statistics = {}
54
+ data['stats'].each do |key, stat|
55
+ @statistics[key] = stat
56
+ end
57
+ @subType=data['subType']
58
+ @teamId=data['teamId']
59
+ end
60
+ end
61
+
62
+ # player of a game
63
+ # @attr [Fixnum] championId ID of played Champion
64
+ # @attr [Fixnum] summonerId ID of the summoner
65
+ # @attr [Fixnum] teammId ID of the team
66
+ class Player
67
+ attr_accessor :championId, :summonerId, :teamId
68
+
69
+ def initialize(data)
70
+ @championId = data['championId']
71
+ @summonerId = data['summonerId']
72
+ @teamId = data['teamId']
73
+ end
74
+ end
75
+
76
+ end