sightstone 0.6.0 → 0.9.0

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: 03ecf96e34045604da8d2b7f9acfb3fcaf877f06
4
- data.tar.gz: ef7984584413ad9cb2a37d473f455fb87573c910
3
+ metadata.gz: 1a05d3f035d3a0ac01cc753b4f5bb8cffa2c1608
4
+ data.tar.gz: f71878adee457931d79e38ab063dafc12330e4cf
5
5
  SHA512:
6
- metadata.gz: 5a799483b0723d247ccec6835bd889adabf87668d24cf295612cc5162601e0c2048e36fe5c46ee230bf483a29c7c716361aab472b0f77f8174d702b183fca958
7
- data.tar.gz: 3ce13ece552482e2d92e91afda5bcedd7999b412adb965dcc8467b1542f26e44c5bf58b20d6a9f6a66e1ce7e0b23f5132b3e1c44bae49e09c08f4e0939b8947f
6
+ metadata.gz: 392c096c578bb08d475b394caf6b6b97dc8d4a53aac459446db1aa23a819fb921ce51e5705b02dbaa1c19a30631007316c1aebf27bcf7eb8e7ad3222826d9992
7
+ data.tar.gz: 63fdab5267b0a95dd072ef49fed9e9e666d0b5c8136525b581903d8e0849dc46d188248726ef810a008e2153139d2df67779991553a0a9279b76ece93ec4425f
@@ -1,5 +1,8 @@
1
1
  require 'sightstone/stat'
2
2
 
3
+ # match history of a summoner
4
+ # @attr [Fixnum] summonerId ID of the summoner
5
+ # @attr [Array<HistoryGame>] games unsorted list of recently played games
3
6
  class MatchHistory
4
7
  attr_accessor :games, :summonerId
5
8
 
@@ -7,13 +10,28 @@ class MatchHistory
7
10
  @summonerId = data['summonerId']
8
11
  @games = []
9
12
  data['games'].each do |game|
10
- games << Game.new(game)
13
+ games << HistoryGame.new(game)
11
14
  end
12
15
  end
13
16
  end
14
17
 
15
- class Game
16
- attr_accessor :championId, :createDate, :createDateString, :fellowPlayers, :gameId, :gameMode, :gameType, :invalid, :level, :mapId, :spell1, :spell2, :statistics, :subType, :teamId
18
+ # A played game
19
+ # @attr [Fixnum] championId ID of the played champ of requested summoner
20
+ # @attr [Fixnum] createDate UNIX timestamp of creation date of the games
21
+ # @attr [Array<Player>] fellowPlayers a list of all players of the game
22
+ # @attr [Fixnum] gameId ID of the game
23
+ # @attr [String] gameMode mode of the game
24
+ # @attr [String] gameType type of the game
25
+ # @attr [Boolean] invalid Invalid flag #TODO what is this?
26
+ # @attr [Fixnum] level level of the requested summoner
27
+ # @attr [Fixnum] mapId ID of the played map
28
+ # @attr [Fixnum] spell1 selected summoner spell no 1
29
+ # @attr [Fixnum] spell2 selected summoner spell no 2
30
+ # @attr [String] subtype subtype
31
+ # @attr [Fixnum] teamId ID of the team if there is a team associated to the game
32
+ # @attr [Array<Stat>] statistics statistics of the game
33
+ class HistoryGame
34
+ attr_accessor :championId, :createDate, :fellowPlayers, :gameId, :gameMode, :gameType, :invalid, :level, :mapId, :spell1, :spell2, :statistics, :subType, :teamId
17
35
 
18
36
  def initialize(data)
19
37
  @championId=data['championId']
@@ -29,7 +47,7 @@ class Game
29
47
  @invalid=data['invalid']
30
48
  @level=data['level']
31
49
  @mapId=data['mapId']
32
- @spell1=data['spell1]']
50
+ @spell1=data['spell1']
33
51
  @spell2=data['spell2']
34
52
  @statistics = []
35
53
  data['statistics'].each do |stat|
@@ -40,6 +58,10 @@ class Game
40
58
  end
41
59
  end
42
60
 
61
+ # player of a game
62
+ # @attr [Fixnum] championId ID of played Champion
63
+ # @attr [Fixnum] summonerId ID of the summoner
64
+ # @attr [Fixnum] teammId ID of the team
43
65
  class Player
44
66
  attr_accessor :championId, :summonerId, :teamId
45
67
 
@@ -48,4 +70,22 @@ class Player
48
70
  @summonerId = data['summonerId']
49
71
  @teamId = data['teamId']
50
72
  end
73
+ end
74
+
75
+ # statistical value of a game
76
+ # @attr [Fixnum] id ID of the statistical value
77
+ # @attr [String] mame name of the statistical value (example: MINIONS_KILLED)
78
+ # @attr [Fixnum] value value
79
+ class Stat
80
+ attr_accessor :id, :name, :value
81
+
82
+ def initialize(data)
83
+ @name = data['name']
84
+ @id = data['id']
85
+ @value = if data.has_key? 'value'
86
+ data['value']
87
+ else
88
+ data['count']
89
+ end
90
+ end
51
91
  end
@@ -2,12 +2,17 @@ require 'sightstone/modules/sightstone_base_module'
2
2
  require 'sightstone/summoner'
3
3
  require 'sightstone/match_history'
4
4
 
5
+ # module to access the game api
5
6
  class GameModule < SightstoneBaseModule
6
7
 
7
8
  def initialize(sightstone)
8
9
  @sightstone = sightstone
9
10
  end
10
11
 
12
+ # returns the match history of a summoner
13
+ # @param [Summoner, Fixnum] summoner summoner object or id of a summoner
14
+ # @param optional [Hash] optional arguments: :region => replaces default region
15
+ # @return [MatchHistory] match history of the summoner
11
16
  def recent(summoner, optional={})
12
17
  region = optional[:region] || @sightstone.region
13
18
  id = if summoner.is_a? Summoner
@@ -15,7 +20,7 @@ class GameModule < SightstoneBaseModule
15
20
  else
16
21
  summoner
17
22
  end
18
- uri = "https://prod.api.pvp.net/api/lol/#{region}/v1.1/game/by-summoner/#{id}/recent"
23
+ uri = "https://prod.api.pvp.net/api/lol/#{region}/v1.2/game/by-summoner/#{id}/recent"
19
24
 
20
25
  response = _get_api_response(uri)
21
26
  _parse_response(response) { |resp|
@@ -2,11 +2,16 @@ require 'sightstone/modules/sightstone_base_module'
2
2
  require 'sightstone/summoner'
3
3
  require 'sightstone/team'
4
4
 
5
+ # module to make calls to the team api
5
6
  class TeamModule < SightstoneBaseModule
6
7
  def initialize(sightstone)
7
8
  @sightstone = sightstone
8
9
  end
9
10
 
11
+ # call to receive all teams for a summoner
12
+ # @param [Summoner, Fixnum] summoner summoner object or id of a summoner
13
+ # @param optional [Hash] optional arguments: :region => replaces default region
14
+ # @ return [Array<Team>] An array containing all teams of the given summoner
10
15
  def teams(summoner, optional={})
11
16
  region = optional[:region] || @sightstone.region
12
17
  id = if summoner.is_a? Summoner
@@ -15,7 +20,7 @@ class TeamModule < SightstoneBaseModule
15
20
  summoner
16
21
  end
17
22
 
18
- uri = "https://prod.api.pvp.net/api/#{region}/v2.1/team/by-summoner/#{id}"
23
+ uri = "https://prod.api.pvp.net/api/lol/#{region}/v2.2/team/by-summoner/#{id}"
19
24
 
20
25
  response = _get_api_response(uri)
21
26
  _parse_response(response) { |resp|
@@ -1,18 +1,32 @@
1
+ # A Team
2
+ # @attr [Fixnum] createDate UNIX timestamp of team creation
3
+ # @attr [String] fullId id of the team
4
+ # @attr [Fixnum] lastGameDate UNIX timespamp of last game
5
+ # @attr [Fixnum] lastJoinDate UNIX timestamp of the date where the newest player joined the team
6
+ # @attr [Fixnum] lastJoinedRankedTeamQueueDate UNIX timestamp of latest team game
7
+ # @attr [Array<TeamHistoryGame>] matchHistory List of latest games
8
+ # @attr [Fixnum] modifyDate UNIX timestamp of latest team modification
9
+ # @attr [String] name team name
10
+ # @attr [Roster] roster team roster
11
+ # @attr [Fixnum] secondLastJoinDate UNIX timestamp of second latest join date of a member
12
+ # @attr [String] status team status
13
+ # @attr [String] tag tag of the team
14
+ # @attr [Array<TeamStat>] teamStatSummary array containing the stats of the team
15
+ # @attr [Fixnum] thridLastJoinDate UNIX timestamp of third latest join date of a member
1
16
  class Team
2
- attr_accessor :teamStatSummary, :status, :tag, :roster, :lastGameDate, :modifyDate, :teamId, :timestamp, :lastJoinDate, :secondLastJoinDate, :matchHistory, :lastJoinedRankedTeamQueueDate, :name, :thirdLastJoinDate, :createDate
17
+ attr_accessor :teamStatSummary, :status, :tag, :roster, :lastGameDate, :modifyDate, :teamId, :lastJoinDate, :secondLastJoinDate, :matchHistory, :lastJoinedRankedTeamQueueDate, :name, :thirdLastJoinDate, :createDate
3
18
  def initialize(data)
4
19
  @status = data['status']
5
20
  @tag = data['tag']
6
21
  @roster = Roster.new(data['roster'])
7
22
  @lastGameDate = data['lastGameDate']
8
23
  @modifyDate = data['modifyDate']
9
- @teamId = data['teamId']['fullId']
10
- @timestamp = data['timestamp']
24
+ @teamId = data['fullId']
11
25
  @lastJoinDate = data['lastJoinDate']
12
26
  @secondLastJoinDate = data['secondLastJoinDate']
13
27
  @matchHistory = []
14
28
  data['matchHistory'].each do |game|
15
- matchHistory << Game.new(game)
29
+ matchHistory << TeamHistoryGame.new(game)
16
30
  end
17
31
  @lastJoinedRankedTeamQueueDate=data['lastJoinedRankedTeamQueueDate']
18
32
  @name = data['name']
@@ -26,6 +40,9 @@ class Team
26
40
  end
27
41
  end
28
42
 
43
+ # class to represent the roster of a team
44
+ # @attr [Fixnum] ownerId summoner ID of the team owner
45
+ # @attr [Array<Member>] memberList list of all team members
29
46
  class Roster
30
47
  attr_accessor :ownerId, :memberList
31
48
  def initialize(data)
@@ -37,6 +54,11 @@ class Roster
37
54
  end
38
55
  end
39
56
 
57
+ # member of a team
58
+ # @attr [Fixnum] joinDate UNIX timestamp of join date
59
+ # @attr [Fixnum] inviteDate UNIX timestamp of invitation date
60
+ # @attr [String] status status of the team member
61
+ # @attr [Fixnum] playerId summoner ID of the member
40
62
  class Member
41
63
  attr_accessor :joinDate, :inviteDate, :status, :playerId
42
64
  def initialize(data)
@@ -47,20 +69,37 @@ class Member
47
69
  end
48
70
  end
49
71
 
50
- class TeamStat
51
- attr_accessor :wins, :losses, :averageGamesPlayed, :teamId, :teamStatType
72
+ # statistical overview of a team
73
+ # @attr [Fixnum] wins number of won games
74
+ # @attr [Fixnum] losses number of lost games
75
+ # @attr [Fixnum] averageFamesPlayed average played games of member
76
+ # @attr [String] fullId id of the team
77
+ # @attr [String] teamStatType queue of the stat
78
+ class TeamStat
79
+ attr_accessor :wins, :losses, :averageGamesPlayed, :fullId, :teamStatType
52
80
  def initialize(data)
53
81
  @wins = data['wins']
54
82
  @losses = data['losses']
55
83
  @averageGamesPlayed = data['averageGamesPlayed']
56
- @teamId = data['teamId']
84
+ @fullId = data['fullId']
57
85
  @teamStatType = data['teamStatType']
58
86
 
59
87
  end
60
88
  end
61
89
 
62
- class Game
63
- attr_accessor :gameMode, :mapId, :assists, :opposingTeamName, :invalid, :deaths, :gameId, :kills, :win, :date, :opposingTeamKills
90
+ # Recent game of a team
91
+ # @attr [Fixnum] gameMode mode of the game
92
+ # @attr [Fixnum] mapId ID of the map
93
+ # @attr [Fixnum] assists assists of the team
94
+ # @attr [String] opposingTeamName name of the enemy team
95
+ # @attr [Boolean] invalid Invalid flag # TODO what is this?
96
+ # @attr [Fixnum] deaths number of deaths summed over all players of the team
97
+ # @attr [Boolean] win true if game has been won by the team
98
+ # @attr [Fixnum] opposingTeamKills number of kills of the enemy team
99
+ # @attr [Fixnum] gameId ID of the game
100
+ # @attr [Fixnum] kills kills of the team
101
+ class TeamHistoryGame
102
+ attr_accessor :gameMode, :mapId, :assists, :opposingTeamName, :invalid, :deaths, :gameId, :kills, :win, :opposingTeamKills
64
103
  def initialize(data)
65
104
  @gameMode = data['gameMode']
66
105
  @mapId = data['mapId']
@@ -71,7 +110,6 @@ class Game
71
110
  @gameId = data['gameId']
72
111
  @kills = data['kills']
73
112
  @win = data['win']
74
- @date = data['date']
75
113
  @opposingTeamKills = data['opposingTeamKills']
76
114
  end
77
115
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sightstone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2012-12-31 00:00:00.000000000 Z
11
+ date: 2014-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -44,6 +44,7 @@ executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
+ - lib/sightstone.rb
47
48
  - lib/sightstone/champion.rb
48
49
  - lib/sightstone/league.rb
49
50
  - lib/sightstone/masterybook.rb
@@ -59,10 +60,8 @@ files:
59
60
  - lib/sightstone/player_stats_summary.rb
60
61
  - lib/sightstone/ranked_stats.rb
61
62
  - lib/sightstone/runebook.rb
62
- - lib/sightstone/stat.rb
63
63
  - lib/sightstone/summoner.rb
64
64
  - lib/sightstone/team.rb
65
- - lib/sightstone.rb
66
65
  homepage: https://github.com/danijoo/Sightstone
67
66
  licenses:
68
67
  - MIT
@@ -83,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
82
  version: '0'
84
83
  requirements: []
85
84
  rubyforge_project:
86
- rubygems_version: 2.1.10
85
+ rubygems_version: 2.2.0
87
86
  signing_key:
88
87
  specification_version: 4
89
88
  summary: Ruby wrapper for riots league of legends api
@@ -1,12 +0,0 @@
1
- class Stat
2
- attr_accessor :name, :value
3
-
4
- def initialize(data)
5
- @name = data['name']
6
- @value = if data.has_key? 'value'
7
- data['value']
8
- else
9
- data['count']
10
- end
11
- end
12
- end