sightstone 1.4.3 → 1.4.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.
- checksums.yaml +4 -4
- data/lib/sightstone.rb +60 -60
- data/lib/sightstone/champion.rb +31 -31
- data/lib/sightstone/league.rb +74 -74
- data/lib/sightstone/masterybook.rb +49 -49
- data/lib/sightstone/match_history.rb +76 -76
- data/lib/sightstone/modules/champion_module.rb +33 -33
- data/lib/sightstone/modules/datadragon_module.rb +25 -25
- data/lib/sightstone/modules/game_module.rb +38 -38
- data/lib/sightstone/modules/league_module.rb +68 -40
- data/lib/sightstone/modules/sightstone_base_module.rb +39 -39
- data/lib/sightstone/modules/stats_module.rb +75 -75
- data/lib/sightstone/modules/summoner_module.rb +205 -205
- data/lib/sightstone/modules/team_module.rb +42 -42
- data/lib/sightstone/player_stats_summary.rb +38 -38
- data/lib/sightstone/ranked_stats.rb +24 -24
- data/lib/sightstone/runebook.rb +51 -51
- data/lib/sightstone/summoner.rb +22 -22
- data/lib/sightstone/team.rb +116 -116
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c71f5bd3e8cb1129de387d9b22995dd6b8be06e0
|
4
|
+
data.tar.gz: 2f8d16bb72b7ba75d153f4b1936966df4763bdef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4e927ae20e12a9d801bd39943b2555acbe96832e93fe31a826feca2f43f6485697a6af05893d483f305d359f57a781a5c99dba9abe716260181a4df56d2de36
|
7
|
+
data.tar.gz: c417467d44cd42a7cee291f0233fa3dcc031ced3e43c012a2009c412e85efbbf3cf22201ab639f4db0bcc4f19ddf2391e0e0083a18dd5240e95ec96c5d59eff7
|
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
|
data/lib/sightstone/champion.rb
CHANGED
@@ -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
|
data/lib/sightstone/league.rb
CHANGED
@@ -1,74 +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, :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
|
+
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
|