league_of_legends 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/lib/league_of_legends/dto.rb +1 -0
- data/lib/league_of_legends/dto/team_list.rb +23 -0
- data/lib/league_of_legends/dto/team_map.rb +2 -2
- data/lib/league_of_legends/request.rb +2 -0
- data/lib/league_of_legends/request/team.rb +31 -0
- data/lib/league_of_legends/request/team/by_summoner.rb +29 -0
- data/lib/league_of_legends/version.rb +1 -1
- data/spec/league_of_legends/api_spec.rb +8 -4
- data/spec/league_of_legends/dto/aggregated_stats_spec.rb +35 -33
- data/spec/league_of_legends/dto/base_spec.rb +1 -1
- data/spec/league_of_legends/dto/champion_list_spec.rb +3 -3
- data/spec/league_of_legends/dto/champion_spec.rb +5 -3
- data/spec/league_of_legends/dto/champion_stats_spec.rb +35 -31
- data/spec/league_of_legends/dto/game_spec.rb +65 -29
- data/spec/league_of_legends/dto/team_list_spec.rb +71 -0
- data/spec/league_of_legends/dto/team_map_spec.rb +2 -2
- data/spec/league_of_legends/request/base_spec.rb +2 -2
- data/spec/league_of_legends/request/champion_spec.rb +2 -2
- data/spec/league_of_legends/request/game/by_summoner/recent_spec.rb +3 -3
- data/spec/league_of_legends/request/league/by_summoner/entry_spec.rb +2 -2
- data/spec/league_of_legends/request/league/by_summoner_spec.rb +2 -2
- data/spec/league_of_legends/request/league/challenger_spec.rb +2 -2
- data/spec/league_of_legends/request/stats/by_summoner/ranked_spec.rb +3 -3
- data/spec/league_of_legends/request/stats/by_summoner/summary_spec.rb +3 -3
- data/spec/league_of_legends/request/team/by_summoner_spec.rb +26 -0
- data/spec/league_of_legends/request/team_spec.rb +29 -0
- data/spec/league_of_legends/spec_helper.rb +3 -1
- data/spec/setup_vcr.rb +1 -1
- metadata +12 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef79ef1dc3eef4319436a9b9aec34786d4a16716
|
4
|
+
data.tar.gz: f3ffd220f61d441fe5e50fdfb9b38ffb3fd980f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f42c617b55b74e7f332a98e2b4707e36bc511eab5bacda45235c1f3938222a5241a48892188ce7243092419cb899b5302695f0a43bd373911b0da12b07ab4ccf
|
7
|
+
data.tar.gz: 99c3738a098537425fa7a9923b8f73968a4db06c1045b2035924a6b7a1e770f13f23d1e81997bd7ce1fcd15612eea9dc4d046856c76dfadeb00f4ee2f4fe163d
|
data/.travis.yml
CHANGED
@@ -19,6 +19,7 @@ require 'league_of_legends/dto/raw_stats'
|
|
19
19
|
require 'league_of_legends/dto/recent_games'
|
20
20
|
require 'league_of_legends/dto/roster'
|
21
21
|
require 'league_of_legends/dto/team'
|
22
|
+
require 'league_of_legends/dto/team_list'
|
22
23
|
require 'league_of_legends/dto/team_map'
|
23
24
|
require 'league_of_legends/dto/team_member_info'
|
24
25
|
require 'league_of_legends/dto/team_stat_detail'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'league_of_legends/dto'
|
2
|
+
|
3
|
+
module ::LeagueOfLegends
|
4
|
+
module DTO
|
5
|
+
class TeamList < ::LeagueOfLegends::DTO::Base
|
6
|
+
|
7
|
+
def self.version
|
8
|
+
::LeagueOfLegends::DTO::Team.version
|
9
|
+
end
|
10
|
+
|
11
|
+
attr_reader :teams
|
12
|
+
|
13
|
+
def initialize json
|
14
|
+
attributes = build_attributes json
|
15
|
+
|
16
|
+
@teams = attributes.each do |team|
|
17
|
+
::LeagueOfLegends::DTO::Team.new(team)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -8,12 +8,12 @@ module ::LeagueOfLegends
|
|
8
8
|
::LeagueOfLegends::DTO::Team.version
|
9
9
|
end
|
10
10
|
|
11
|
-
attr_reader :
|
11
|
+
attr_reader :teams
|
12
12
|
|
13
13
|
def initialize json
|
14
14
|
attributes = build_attributes json
|
15
15
|
|
16
|
-
@
|
16
|
+
@teams = attributes.each_with_object({}) do |(team_id, team_dto), map|
|
17
17
|
map[team_id.to_s] = ::LeagueOfLegends::DTO::Team.new(team_dto)
|
18
18
|
end
|
19
19
|
end
|
@@ -7,3 +7,5 @@ require 'league_of_legends/request/league/challenger'
|
|
7
7
|
require 'league_of_legends/request/mapper'
|
8
8
|
require 'league_of_legends/request/stats/by_summoner/ranked'
|
9
9
|
require 'league_of_legends/request/stats/by_summoner/summary'
|
10
|
+
require 'league_of_legends/request/team'
|
11
|
+
require 'league_of_legends/request/team/by_summoner'
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'league_of_legends/dto'
|
2
|
+
|
3
|
+
module ::LeagueOfLegends
|
4
|
+
module Request
|
5
|
+
class Team < ::LeagueOfLegends::Request::Base
|
6
|
+
|
7
|
+
attr_reader :team_ids
|
8
|
+
|
9
|
+
def initialize api, team_ids, options = {}
|
10
|
+
super(api, options)
|
11
|
+
|
12
|
+
@team_ids = if team_ids.is_a? String
|
13
|
+
team_ids.split(",")
|
14
|
+
elsif team_ids.is_a? Array
|
15
|
+
team_ids
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.dto_class
|
20
|
+
::LeagueOfLegends::DTO::TeamMap
|
21
|
+
end
|
22
|
+
|
23
|
+
protected
|
24
|
+
|
25
|
+
def base_url
|
26
|
+
super << "team/#{team_ids.join(',')}"
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'league_of_legends/dto'
|
2
|
+
|
3
|
+
module ::LeagueOfLegends
|
4
|
+
module Request
|
5
|
+
class Team
|
6
|
+
class BySummoner < ::LeagueOfLegends::Request::Base
|
7
|
+
|
8
|
+
attr_reader :summoner_id
|
9
|
+
|
10
|
+
def initialize api, summoner_id, options = {}
|
11
|
+
super(api, options)
|
12
|
+
|
13
|
+
@summoner_id = summoner_id
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.dto_class
|
17
|
+
::LeagueOfLegends::DTO::TeamList
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
|
22
|
+
def base_url
|
23
|
+
super << "team/by-summoner/#{summoner_id}"
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -2,7 +2,7 @@ require_relative 'spec_helper'
|
|
2
2
|
|
3
3
|
describe ::LeagueOfLegends::Api do
|
4
4
|
|
5
|
-
let(:api) { ::LeagueOfLegends::Api.new
|
5
|
+
let(:api) { ::LeagueOfLegends::Api.new TEST_API_KEY }
|
6
6
|
|
7
7
|
it "has access to an API key" do
|
8
8
|
expect(api.key).to be_an_instance_of String
|
@@ -19,11 +19,15 @@ describe ::LeagueOfLegends::Api do
|
|
19
19
|
|
20
20
|
it "can send requests and receive a response" do
|
21
21
|
VCR.use_cassette('api_spec summoner_stats_summary') do
|
22
|
-
expect(api.get(:summoner_stats_summary,
|
22
|
+
expect(api.get(:summoner_stats_summary, 50_519_866)).to(
|
23
|
+
be_an_instance_of ::LeagueOfLegends::DTO::PlayerStatsSummaryList
|
24
|
+
)
|
23
25
|
end
|
24
26
|
VCR.use_cassette('api_spec champions') do
|
25
|
-
expect(api.get(:champions, true)).to
|
27
|
+
expect(api.get(:champions, true)).to(
|
28
|
+
be_an_instance_of ::LeagueOfLegends::DTO::ChampionList
|
29
|
+
)
|
26
30
|
end
|
27
31
|
end
|
28
32
|
|
29
|
-
end
|
33
|
+
end
|
@@ -2,32 +2,34 @@ require_relative '../spec_helper'
|
|
2
2
|
|
3
3
|
describe ::LeagueOfLegends::DTO::AggregatedStats do
|
4
4
|
|
5
|
-
let(:attributes)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
5
|
+
let(:attributes) do
|
6
|
+
{
|
7
|
+
totalChampionKills: 72,
|
8
|
+
totalMinionKills: 1530,
|
9
|
+
totalTurretsKilled: 29,
|
10
|
+
totalNeutralMinionsKilled: 339,
|
11
|
+
totalAssists: 75,
|
12
|
+
totalSessionsPlayed: 2,
|
13
|
+
totalSessionsLost: 1,
|
14
|
+
totalSessionsWon: 1,
|
15
|
+
totalDamageDealt: 256026,
|
16
|
+
totalDamageTaken: 62473,
|
17
|
+
mostChampionKillsPerSession: 4,
|
18
|
+
totalDoubleKills: 0,
|
19
|
+
totalTripleKills: 0,
|
20
|
+
totalQuadraKills: 0,
|
21
|
+
totalPentaKills: 0,
|
22
|
+
totalUnrealKills: 0,
|
23
|
+
totalDeathsPerSession: 9,
|
24
|
+
totalGoldEarned: 25091,
|
25
|
+
mostSpellsCast: 0,
|
26
|
+
totalPhysicalDamageDealt: 211641,
|
27
|
+
totalMagicDamageDealt: 24715,
|
28
|
+
totalFirstBlood: 0,
|
29
|
+
maxChampionsKilled: 4,
|
30
|
+
maxNumDeaths: 6
|
31
|
+
}
|
32
|
+
end
|
31
33
|
let(:dto) { described_class.new(attributes) }
|
32
34
|
|
33
35
|
it "has attributes" do
|
@@ -40,8 +42,8 @@ describe ::LeagueOfLegends::DTO::AggregatedStats do
|
|
40
42
|
expect(dto.total_sessions_played).to eq 2
|
41
43
|
expect(dto.total_sessions_lost).to eq 1
|
42
44
|
expect(dto.total_sessions_won).to eq 1
|
43
|
-
expect(dto.total_damage_dealt).to eq
|
44
|
-
expect(dto.total_damage_taken).to eq
|
45
|
+
expect(dto.total_damage_dealt).to eq 256_026
|
46
|
+
expect(dto.total_damage_taken).to eq 62_473
|
45
47
|
expect(dto.most_champion_kills_per_session).to eq 4
|
46
48
|
expect(dto.total_double_kills).to eq 0
|
47
49
|
expect(dto.total_triple_kills).to eq 0
|
@@ -49,10 +51,10 @@ describe ::LeagueOfLegends::DTO::AggregatedStats do
|
|
49
51
|
expect(dto.total_penta_kills).to eq 0
|
50
52
|
expect(dto.total_unreal_kills).to eq 0
|
51
53
|
expect(dto.total_deaths_per_session).to eq 9
|
52
|
-
expect(dto.total_gold_earned).to eq
|
54
|
+
expect(dto.total_gold_earned).to eq 25_091
|
53
55
|
expect(dto.most_spells_cast).to eq 0
|
54
|
-
expect(dto.total_physical_damage_dealt).to eq
|
55
|
-
expect(dto.total_magic_damage_dealt).to eq
|
56
|
+
expect(dto.total_physical_damage_dealt).to eq 211_641
|
57
|
+
expect(dto.total_magic_damage_dealt).to eq 24_715
|
56
58
|
expect(dto.total_first_blood).to eq 0
|
57
59
|
expect(dto.max_champions_killed).to eq 4
|
58
60
|
expect(dto.max_num_deaths).to eq 6
|
@@ -61,5 +63,5 @@ describe ::LeagueOfLegends::DTO::AggregatedStats do
|
|
61
63
|
it "has a version" do
|
62
64
|
expect(described_class.version).to eq 'v1.2'
|
63
65
|
end
|
64
|
-
|
65
|
-
end
|
66
|
+
|
67
|
+
end
|
@@ -2,7 +2,7 @@ require_relative '../spec_helper'
|
|
2
2
|
|
3
3
|
describe ::LeagueOfLegends::DTO::ChampionList do
|
4
4
|
|
5
|
-
json = '{"champions":
|
5
|
+
json = '{"champions":
|
6
6
|
[
|
7
7
|
{
|
8
8
|
"botMmEnabled": false,
|
@@ -44,7 +44,7 @@ describe ::LeagueOfLegends::DTO::ChampionList do
|
|
44
44
|
"magicRank": 8
|
45
45
|
}
|
46
46
|
]}'
|
47
|
-
let(:dto){ described_class.new(json) }
|
47
|
+
let(:dto) { described_class.new(json) }
|
48
48
|
|
49
49
|
it "has attributes" do
|
50
50
|
expect(dto.champions).to be_an_instance_of Array
|
@@ -59,4 +59,4 @@ describe ::LeagueOfLegends::DTO::ChampionList do
|
|
59
59
|
expect(described_class.version).to eq 'v1.1'
|
60
60
|
end
|
61
61
|
|
62
|
-
end
|
62
|
+
end
|
@@ -2,7 +2,8 @@ require_relative '../spec_helper'
|
|
2
2
|
|
3
3
|
describe ::LeagueOfLegends::DTO::Champion do
|
4
4
|
|
5
|
-
let(:attributes)
|
5
|
+
let(:attributes) do
|
6
|
+
{
|
6
7
|
botMmEnabled: false,
|
7
8
|
defenseRank: 4,
|
8
9
|
attackRank: 3,
|
@@ -14,7 +15,8 @@ describe ::LeagueOfLegends::DTO::Champion do
|
|
14
15
|
active: true,
|
15
16
|
freeToPlay: false,
|
16
17
|
magicRank: 8
|
17
|
-
|
18
|
+
}
|
19
|
+
end
|
18
20
|
let(:dto) { described_class.new(attributes) }
|
19
21
|
|
20
22
|
it "has attributes" do
|
@@ -35,4 +37,4 @@ describe ::LeagueOfLegends::DTO::Champion do
|
|
35
37
|
expect(described_class.version).to eq 'v1.1'
|
36
38
|
end
|
37
39
|
|
38
|
-
end
|
40
|
+
end
|
@@ -2,45 +2,49 @@ require_relative '../spec_helper'
|
|
2
2
|
|
3
3
|
describe ::LeagueOfLegends::DTO::ChampionStats do
|
4
4
|
|
5
|
-
let(:json)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
5
|
+
let(:json) do
|
6
|
+
{
|
7
|
+
id: 59,
|
8
|
+
name: "JarvanIV",
|
9
|
+
stats: {
|
10
|
+
totalSessionsPlayed: 2,
|
11
|
+
totalSessionsLost: 1,
|
12
|
+
totalSessionsWon: 1,
|
13
|
+
totalChampionKills: 8,
|
14
|
+
totalDamageDealt: 256026,
|
15
|
+
totalDamageTaken: 62473,
|
16
|
+
mostChampionKillsPerSession: 4,
|
17
|
+
totalMinionKills: 112,
|
18
|
+
totalDoubleKills: 0,
|
19
|
+
totalTripleKills: 0,
|
20
|
+
totalQuadraKills: 0,
|
21
|
+
totalPentaKills: 0,
|
22
|
+
totalUnrealKills: 0,
|
23
|
+
totalDeathsPerSession: 9,
|
24
|
+
totalGoldEarned: 25091,
|
25
|
+
mostSpellsCast: 0,
|
26
|
+
totalTurretsKilled: 4,
|
27
|
+
totalPhysicalDamageDealt: 211641,
|
28
|
+
totalMagicDamageDealt: 24715,
|
29
|
+
totalFirstBlood: 0,
|
30
|
+
totalAssists: 39,
|
31
|
+
maxChampionsKilled: 4,
|
32
|
+
maxNumDeaths: 6
|
33
|
+
}
|
32
34
|
}
|
33
|
-
|
34
|
-
let(:dto){ described_class.new(json) }
|
35
|
+
end
|
36
|
+
let(:dto) { described_class.new(json) }
|
35
37
|
|
36
38
|
it "has attributes" do
|
37
39
|
expect(dto.id).to eq 59
|
38
40
|
expect(dto.name).to eq 'JarvanIV'
|
39
|
-
expect(dto.stats).to
|
41
|
+
expect(dto.stats).to(
|
42
|
+
be_an_instance_of ::LeagueOfLegends::DTO::AggregatedStats
|
43
|
+
)
|
40
44
|
end
|
41
45
|
|
42
46
|
it "has a version" do
|
43
47
|
expect(described_class.version).to eq 'v1.2'
|
44
48
|
end
|
45
49
|
|
46
|
-
end
|
50
|
+
end
|
@@ -2,37 +2,73 @@ require_relative '../spec_helper'
|
|
2
2
|
|
3
3
|
describe ::LeagueOfLegends::DTO::Game do
|
4
4
|
|
5
|
-
let(:json)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
5
|
+
let(:json) do
|
6
|
+
{
|
7
|
+
gameId: 1316392770,
|
8
|
+
invalid: false,
|
9
|
+
gameMode: "CLASSIC",
|
10
|
+
gameType: "MATCHED_GAME",
|
11
|
+
subType: "NORMAL",
|
12
|
+
mapId: 1,
|
13
|
+
teamId: 200,
|
14
|
+
championId: 22,
|
15
|
+
spell1: 21,
|
16
|
+
spell2: 6,
|
17
|
+
level: 11,
|
18
|
+
createDate: 1391913992873,
|
19
|
+
fellowPlayers: [
|
20
|
+
{ summonerId: 46493314, teamId: 100, championId: 7 },
|
21
|
+
{ summonerId: 49460388, teamId: 200, championId: 222 },
|
22
|
+
{ summonerId: 52345403, teamId: 100, championId: 34 },
|
23
|
+
{ summonerId: 19474335, teamId: 200, championId: 37 },
|
24
|
+
{ summonerId: 46825692, teamId: 100, championId: 222 },
|
25
|
+
{ summonerId: 20901501, teamId: 100, championId: 26 },
|
26
|
+
{ summonerId: 49574516, teamId: 200, championId: 1 },
|
27
|
+
{ summonerId: 38380347, teamId: 100, championId: 77 },
|
28
|
+
{ summonerId: 32957220, teamId: 200, championId: 77 }
|
29
|
+
],
|
30
|
+
stats: {
|
31
|
+
level: 12,
|
32
|
+
goldEarned: 6372,
|
33
|
+
numDeaths: 6,
|
34
|
+
minionsKilled: 76,
|
35
|
+
goldSpent: 5375,
|
36
|
+
totalDamageDealt: 67406,
|
37
|
+
totalDamageTaken: 19667,
|
38
|
+
team: 200,
|
39
|
+
win: false,
|
40
|
+
neutralMinionsKilled: 8,
|
41
|
+
physicalDamageDealtPlayer: 64404,
|
42
|
+
magicDamageDealtPlayer: 3002,
|
43
|
+
physicalDamageTaken: 7819,
|
44
|
+
magicDamageTaken: 11789,
|
45
|
+
largestCriticalStrike: 327,
|
46
|
+
timePlayed: 1965,
|
47
|
+
totalHeal: 720,
|
48
|
+
totalUnitsHealed: 1,
|
49
|
+
assists: 1,
|
50
|
+
item0: 1055,
|
51
|
+
item1: 1051,
|
52
|
+
item2: 3072,
|
53
|
+
item3: 1001,
|
54
|
+
item4: 3093,
|
55
|
+
item5: 1042,
|
56
|
+
item6: 3350,
|
57
|
+
magicDamageDealtToChampions: 1575,
|
58
|
+
physicalDamageDealtToChampions: 10703,
|
59
|
+
totalDamageDealtToChampions: 12278,
|
60
|
+
trueDamageTaken: 58,
|
61
|
+
wardPlaced: 4,
|
62
|
+
neutralMinionsKilledYourJungle: 8,
|
63
|
+
totalTimeCrowdControlDealt: 534
|
64
|
+
}
|
65
|
+
}
|
66
|
+
end
|
31
67
|
let(:dto) { described_class.new(json) }
|
32
68
|
|
33
69
|
it "has attributes" do
|
34
70
|
expect(dto.champion_id).to eq 22
|
35
|
-
expect(dto.create_date).to eq Time.at(
|
71
|
+
expect(dto.create_date).to eq Time.at(1_391_913_992_873 / 1_000)
|
36
72
|
|
37
73
|
expect(dto.fellow_players).to be_an_instance_of Array
|
38
74
|
expect(dto.fellow_players.size).to eq 9
|
@@ -40,7 +76,7 @@ describe ::LeagueOfLegends::DTO::Game do
|
|
40
76
|
expect(player).to be_an_instance_of ::LeagueOfLegends::DTO::Player
|
41
77
|
end
|
42
78
|
|
43
|
-
expect(dto.game_id).to eq
|
79
|
+
expect(dto.game_id).to eq 1_316_392_770
|
44
80
|
expect(dto.game_mode).to eq 'CLASSIC'
|
45
81
|
expect(dto.game_type).to eq 'MATCHED_GAME'
|
46
82
|
expect(dto.invalid).to be_false
|
@@ -57,4 +93,4 @@ describe ::LeagueOfLegends::DTO::Game do
|
|
57
93
|
expect(described_class.version).to eq 'v1.3'
|
58
94
|
end
|
59
95
|
|
60
|
-
end
|
96
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe ::LeagueOfLegends::DTO::TeamList do
|
4
|
+
|
5
|
+
let(:json) {
|
6
|
+
%q([{
|
7
|
+
"teamStatSummary": {
|
8
|
+
"fullId": "TEAM-90e87e50-5131-11e3-ad58-782bcb4ce61a",
|
9
|
+
"teamStatDetails": [
|
10
|
+
{
|
11
|
+
"fullId": "TEAM-90e87e50-5131-11e3-ad58-782bcb4ce61a",
|
12
|
+
"losses": 0,
|
13
|
+
"averageGamesPlayed": 0,
|
14
|
+
"wins": 0,
|
15
|
+
"teamStatType": "RANKED_TEAM_5x5"
|
16
|
+
}
|
17
|
+
]
|
18
|
+
},
|
19
|
+
"status": "RANKED",
|
20
|
+
"tag": "MMosh",
|
21
|
+
"roster": {
|
22
|
+
"ownerId": 24907958,
|
23
|
+
"memberList": [
|
24
|
+
{
|
25
|
+
"joinDate": 1384875907000,
|
26
|
+
"inviteDate": 1384875907000,
|
27
|
+
"status": "MEMBER",
|
28
|
+
"playerId": 24907958
|
29
|
+
}
|
30
|
+
]
|
31
|
+
},
|
32
|
+
"lastGameDate": 1392668305000,
|
33
|
+
"modifyDate": 1392668305000,
|
34
|
+
"fullId": "TEAM-90e87e50-5131-11e3-ad58-782bcb4ce61a",
|
35
|
+
"lastJoinDate": 1388178602000,
|
36
|
+
"secondLastJoinDate": 1384955161000,
|
37
|
+
"matchHistory": [
|
38
|
+
{
|
39
|
+
"gameMode": "CLASSIC",
|
40
|
+
"mapId": 10,
|
41
|
+
"assists": 7,
|
42
|
+
"opposingTeamName": "Infected Dream",
|
43
|
+
"invalid": false,
|
44
|
+
"deaths": 10,
|
45
|
+
"gameId": 1331312632,
|
46
|
+
"kills": 5,
|
47
|
+
"win": false,
|
48
|
+
"date": 1392668306007,
|
49
|
+
"opposingTeamKills": 10
|
50
|
+
}
|
51
|
+
],
|
52
|
+
"lastJoinedRankedTeamQueueDate": 1392666922000,
|
53
|
+
"name": "Metal Moshpit",
|
54
|
+
"thirdLastJoinDate": 1384899325000,
|
55
|
+
"createDate": 1384875907000
|
56
|
+
}])
|
57
|
+
}
|
58
|
+
let(:dto) { described_class.new(json) }
|
59
|
+
|
60
|
+
it "has attributes" do
|
61
|
+
expect(dto.teams.size).to eq 1
|
62
|
+
dto.teams do |team|
|
63
|
+
expect(team).to be_an_instance_of ::LeagueOfLegends::DTO::Team
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
it "has a version" do
|
68
|
+
expect(described_class.version).to eq 'v2.2'
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -55,10 +55,10 @@ describe ::LeagueOfLegends::DTO::TeamMap do
|
|
55
55
|
"createDate": 1384875907000
|
56
56
|
}})
|
57
57
|
}
|
58
|
-
let(:dto){ described_class.new(json) }
|
58
|
+
let(:dto) { described_class.new(json) }
|
59
59
|
|
60
60
|
it "has attributes" do
|
61
|
-
dto.
|
61
|
+
dto.teams.each_pair do |team_id, team_dto|
|
62
62
|
expect(team_id).to eq "TEAM-90e87e50-5131-11e3-ad58-782bcb4ce61a"
|
63
63
|
expect(team_dto).to be_an_instance_of ::LeagueOfLegends::DTO::Team
|
64
64
|
end
|
@@ -2,7 +2,7 @@ require_relative '../spec_helper'
|
|
2
2
|
|
3
3
|
describe ::LeagueOfLegends::Request::Base do
|
4
4
|
|
5
|
-
let(:api) { ::LeagueOfLegends::Api.new
|
5
|
+
let(:api) { ::LeagueOfLegends::Api.new TEST_API_KEY }
|
6
6
|
|
7
7
|
it "exposes methods to it's children" do
|
8
8
|
class ReqTest < described_class
|
@@ -23,4 +23,4 @@ describe ::LeagueOfLegends::Request::Base do
|
|
23
23
|
expect(req_test.respond_to? :send_request).to be_false
|
24
24
|
end
|
25
25
|
|
26
|
-
end
|
26
|
+
end
|
@@ -2,7 +2,7 @@ require_relative '../spec_helper'
|
|
2
2
|
|
3
3
|
describe ::LeagueOfLegends::Request::Champion do
|
4
4
|
|
5
|
-
let(:api) { ::LeagueOfLegends::Api.new
|
5
|
+
let(:api) { ::LeagueOfLegends::Api.new TEST_API_KEY }
|
6
6
|
|
7
7
|
def request f2p
|
8
8
|
described_class.new(api, f2p)
|
@@ -28,4 +28,4 @@ describe ::LeagueOfLegends::Request::Champion do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
end
|
31
|
+
end
|
@@ -2,7 +2,7 @@ require_relative '../../../spec_helper'
|
|
2
2
|
|
3
3
|
describe ::LeagueOfLegends::Request::Game::BySummoner::Recent do
|
4
4
|
|
5
|
-
let(:api) { ::LeagueOfLegends::Api.new
|
5
|
+
let(:api) { ::LeagueOfLegends::Api.new TEST_API_KEY }
|
6
6
|
|
7
7
|
let(:request) { described_class.new api, 50519866 }
|
8
8
|
|
@@ -12,7 +12,7 @@ describe ::LeagueOfLegends::Request::Game::BySummoner::Recent do
|
|
12
12
|
expect(request.region).to eq 'euw'
|
13
13
|
expect(request.api_key).to be_an_instance_of String
|
14
14
|
expect(request.api_key.length).to eq 36
|
15
|
-
|
15
|
+
|
16
16
|
expect(request.summoner_id).to eq 50519866
|
17
17
|
end
|
18
18
|
|
@@ -22,4 +22,4 @@ describe ::LeagueOfLegends::Request::Game::BySummoner::Recent do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
end
|
25
|
+
end
|
@@ -2,7 +2,7 @@ require_relative '../../../spec_helper'
|
|
2
2
|
|
3
3
|
describe ::LeagueOfLegends::Request::League::BySummoner::Entry do
|
4
4
|
|
5
|
-
let(:api) { ::LeagueOfLegends::Api.new
|
5
|
+
let(:api) { ::LeagueOfLegends::Api.new TEST_API_KEY }
|
6
6
|
|
7
7
|
let(:request) { described_class.new api, 31747504 }
|
8
8
|
|
@@ -22,4 +22,4 @@ describe ::LeagueOfLegends::Request::League::BySummoner::Entry do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
end
|
25
|
+
end
|
@@ -2,7 +2,7 @@ require_relative '../../spec_helper'
|
|
2
2
|
|
3
3
|
describe ::LeagueOfLegends::Request::League::BySummoner do
|
4
4
|
|
5
|
-
let(:api) { ::LeagueOfLegends::Api.new
|
5
|
+
let(:api) { ::LeagueOfLegends::Api.new TEST_API_KEY }
|
6
6
|
|
7
7
|
let(:request) { described_class.new api, 31747504 }
|
8
8
|
|
@@ -22,4 +22,4 @@ describe ::LeagueOfLegends::Request::League::BySummoner do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
end
|
25
|
+
end
|
@@ -2,7 +2,7 @@ require_relative '../../spec_helper'
|
|
2
2
|
|
3
3
|
describe ::LeagueOfLegends::Request::League::Challenger do
|
4
4
|
|
5
|
-
let(:api) { ::LeagueOfLegends::Api.new
|
5
|
+
let(:api) { ::LeagueOfLegends::Api.new TEST_API_KEY }
|
6
6
|
|
7
7
|
def request type
|
8
8
|
described_class.new(api, type)
|
@@ -28,4 +28,4 @@ describe ::LeagueOfLegends::Request::League::Challenger do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
end
|
31
|
+
end
|
@@ -2,7 +2,7 @@ require_relative '../../../spec_helper'
|
|
2
2
|
|
3
3
|
describe ::LeagueOfLegends::Request::Stats::BySummoner::Ranked do
|
4
4
|
|
5
|
-
let(:api) { ::LeagueOfLegends::Api.new
|
5
|
+
let(:api) { ::LeagueOfLegends::Api.new TEST_API_KEY }
|
6
6
|
|
7
7
|
let(:request) { described_class.new api, 31747504 }
|
8
8
|
|
@@ -12,7 +12,7 @@ describe ::LeagueOfLegends::Request::Stats::BySummoner::Ranked do
|
|
12
12
|
expect(request.region).to eq 'euw'
|
13
13
|
expect(request.api_key).to be_an_instance_of String
|
14
14
|
expect(request.api_key.length).to eq 36
|
15
|
-
|
15
|
+
|
16
16
|
expect(request.summoner_id).to eq 31747504
|
17
17
|
end
|
18
18
|
|
@@ -22,4 +22,4 @@ describe ::LeagueOfLegends::Request::Stats::BySummoner::Ranked do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
end
|
25
|
+
end
|
@@ -2,7 +2,7 @@ require_relative '../../../spec_helper'
|
|
2
2
|
|
3
3
|
describe ::LeagueOfLegends::Request::Stats::BySummoner::Summary do
|
4
4
|
|
5
|
-
let(:api) { ::LeagueOfLegends::Api.new
|
5
|
+
let(:api) { ::LeagueOfLegends::Api.new TEST_API_KEY }
|
6
6
|
|
7
7
|
let(:request) { described_class.new api, 50519866 }
|
8
8
|
|
@@ -12,7 +12,7 @@ describe ::LeagueOfLegends::Request::Stats::BySummoner::Summary do
|
|
12
12
|
expect(request.region).to eq 'euw'
|
13
13
|
expect(request.api_key).to be_an_instance_of String
|
14
14
|
expect(request.api_key.length).to eq 36
|
15
|
-
|
15
|
+
|
16
16
|
expect(request.summoner_id).to eq 50519866
|
17
17
|
end
|
18
18
|
|
@@ -22,4 +22,4 @@ describe ::LeagueOfLegends::Request::Stats::BySummoner::Summary do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
end
|
25
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
describe ::LeagueOfLegends::Request::Team::BySummoner do
|
4
|
+
|
5
|
+
let(:api) { ::LeagueOfLegends::Api.new TEST_API_KEY }
|
6
|
+
|
7
|
+
def request(summoner_id)
|
8
|
+
described_class.new(api, summoner_id)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "has the required parameters" do
|
12
|
+
expect(described_class.dto_class).to eq ::LeagueOfLegends::DTO::TeamList
|
13
|
+
expect(described_class.version).to eq 'v2.2'
|
14
|
+
expect(request(true).region).to eq 'euw'
|
15
|
+
expect(request(true).api_key).to be_an_instance_of String
|
16
|
+
expect(request(true).api_key.length).to eq 36
|
17
|
+
end
|
18
|
+
|
19
|
+
it "can be sent and get a response"# do
|
20
|
+
# VCR.use_cassette('champion_spec f2p') do
|
21
|
+
# expect(request(true).response).to
|
22
|
+
# be_an_instance_of ::LeagueOfLegends::DTO::ChampionList
|
23
|
+
# end
|
24
|
+
# end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe ::LeagueOfLegends::Request::Team do
|
4
|
+
|
5
|
+
let(:api) { ::LeagueOfLegends::Api.new TEST_API_KEY }
|
6
|
+
|
7
|
+
def request team_ids
|
8
|
+
described_class.new(api, team_ids)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "has the required parameters" do
|
12
|
+
expect(described_class.dto_class).to eq ::LeagueOfLegends::DTO::TeamMap
|
13
|
+
expect(described_class.version).to eq 'v2.2'
|
14
|
+
expect(request(true).region).to eq 'euw'
|
15
|
+
expect(request(true).api_key).to be_an_instance_of String
|
16
|
+
expect(request(true).api_key.length).to eq 36
|
17
|
+
end
|
18
|
+
|
19
|
+
context "can be sent and get a response" do
|
20
|
+
|
21
|
+
example "when given a String"
|
22
|
+
|
23
|
+
example "when given an Array"
|
24
|
+
# VCR.use_cassette('champion_spec f2p') do
|
25
|
+
# expect(request(true).response).to be_an_instance_of ::LeagueOfLegends::DTO::ChampionList
|
26
|
+
# end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
data/spec/setup_vcr.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: league_of_legends
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francisco Orvalho
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- lib/league_of_legends/dto/recent_games.rb
|
129
129
|
- lib/league_of_legends/dto/roster.rb
|
130
130
|
- lib/league_of_legends/dto/team.rb
|
131
|
+
- lib/league_of_legends/dto/team_list.rb
|
131
132
|
- lib/league_of_legends/dto/team_map.rb
|
132
133
|
- lib/league_of_legends/dto/team_member_info.rb
|
133
134
|
- lib/league_of_legends/dto/team_stat_detail.rb
|
@@ -142,6 +143,8 @@ files:
|
|
142
143
|
- lib/league_of_legends/request/mapper.rb
|
143
144
|
- lib/league_of_legends/request/stats/by_summoner/ranked.rb
|
144
145
|
- lib/league_of_legends/request/stats/by_summoner/summary.rb
|
146
|
+
- lib/league_of_legends/request/team.rb
|
147
|
+
- lib/league_of_legends/request/team/by_summoner.rb
|
145
148
|
- lib/league_of_legends/version.rb
|
146
149
|
- spec/fixtures/vcr_cassettes/api_spec_champions.yml
|
147
150
|
- spec/fixtures/vcr_cassettes/api_spec_summoner_stats_summary.yml
|
@@ -173,6 +176,7 @@ files:
|
|
173
176
|
- spec/league_of_legends/dto/raw_stats_spec.rb
|
174
177
|
- spec/league_of_legends/dto/recent_games_spec.rb
|
175
178
|
- spec/league_of_legends/dto/roster_spec.rb
|
179
|
+
- spec/league_of_legends/dto/team_list_spec.rb
|
176
180
|
- spec/league_of_legends/dto/team_map_spec.rb
|
177
181
|
- spec/league_of_legends/dto/team_member_info_spec.rb
|
178
182
|
- spec/league_of_legends/dto/team_spec.rb
|
@@ -187,6 +191,8 @@ files:
|
|
187
191
|
- spec/league_of_legends/request/mapper_spec.rb
|
188
192
|
- spec/league_of_legends/request/stats/by_summoner/ranked_spec.rb
|
189
193
|
- spec/league_of_legends/request/stats/by_summoner/summary_spec.rb
|
194
|
+
- spec/league_of_legends/request/team/by_summoner_spec.rb
|
195
|
+
- spec/league_of_legends/request/team_spec.rb
|
190
196
|
- spec/league_of_legends/spec_helper.rb
|
191
197
|
- spec/setup_vcr.rb
|
192
198
|
homepage: http://github.com/forvalho/league_of_legends
|
@@ -209,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
215
|
version: '0'
|
210
216
|
requirements: []
|
211
217
|
rubyforge_project:
|
212
|
-
rubygems_version: 2.2.
|
218
|
+
rubygems_version: 2.2.2
|
213
219
|
signing_key:
|
214
220
|
specification_version: 4
|
215
221
|
summary: Implementation of the LoL API
|
@@ -244,6 +250,7 @@ test_files:
|
|
244
250
|
- spec/league_of_legends/dto/raw_stats_spec.rb
|
245
251
|
- spec/league_of_legends/dto/recent_games_spec.rb
|
246
252
|
- spec/league_of_legends/dto/roster_spec.rb
|
253
|
+
- spec/league_of_legends/dto/team_list_spec.rb
|
247
254
|
- spec/league_of_legends/dto/team_map_spec.rb
|
248
255
|
- spec/league_of_legends/dto/team_member_info_spec.rb
|
249
256
|
- spec/league_of_legends/dto/team_spec.rb
|
@@ -258,6 +265,8 @@ test_files:
|
|
258
265
|
- spec/league_of_legends/request/mapper_spec.rb
|
259
266
|
- spec/league_of_legends/request/stats/by_summoner/ranked_spec.rb
|
260
267
|
- spec/league_of_legends/request/stats/by_summoner/summary_spec.rb
|
268
|
+
- spec/league_of_legends/request/team/by_summoner_spec.rb
|
269
|
+
- spec/league_of_legends/request/team_spec.rb
|
261
270
|
- spec/league_of_legends/spec_helper.rb
|
262
271
|
- spec/setup_vcr.rb
|
263
272
|
has_rdoc:
|