ruby-lol 0.12.2 → 1.0.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 +4 -4
- data/.editorconfig +16 -0
- data/.gitignore +2 -0
- data/.rspec +1 -0
- data/.rubocop.yml +1157 -0
- data/.travis.yml +1 -1
- data/lib/lol/champion_mastery_request.rb +29 -57
- data/lib/lol/champion_request.rb +19 -23
- data/lib/lol/client.rb +16 -21
- data/lib/lol/dynamic_model.rb +14 -5
- data/lib/lol/featured_game_list.rb +15 -0
- data/lib/lol/league_request.rb +28 -49
- data/lib/lol/lol_status_request.rb +9 -26
- data/lib/lol/masteries_request.rb +14 -0
- data/lib/lol/match_request.rb +51 -9
- data/lib/lol/request.rb +55 -21
- data/lib/lol/runes_request.rb +14 -0
- data/lib/lol/spectator_request.rb +24 -0
- data/lib/lol/static_request.rb +34 -23
- data/lib/lol/summoner_request.rb +22 -51
- data/lib/lol/tournament_request.rb +95 -0
- data/lib/lol/version.rb +1 -1
- data/ruby-lol.gemspec +1 -1
- data/spec/api_version_spec.rb +10 -9
- data/spec/fixtures/{v1.2 → v3}/get-champion-266.json +0 -0
- data/spec/fixtures/{v1.2/get-champion.json → v3/get-champion-all.json} +0 -0
- data/spec/fixtures/{v1.0/get-champion-mastery-champions.json → v3/get-champion-masteries.json} +0 -0
- data/spec/fixtures/{v1.0/get-champion-mastery-champion.json → v3/get-champion-mastery.json} +0 -0
- data/spec/fixtures/v3/get-current-game.json +1 -0
- data/spec/fixtures/v3/get-featured-games.json +1 -0
- data/spec/fixtures/v3/get-ids-by-tc.json +1 -0
- data/spec/fixtures/v3/get-league-challenger.json +1 -0
- data/spec/fixtures/v3/get-league-master.json +1 -0
- data/spec/fixtures/v3/get-league-positions.json +1 -0
- data/spec/fixtures/v3/get-league-summoner.json +1 -0
- data/spec/fixtures/v3/get-lol-status-shard.json +1 -0
- data/spec/fixtures/v3/get-masteries.json +1 -0
- data/spec/fixtures/v3/get-match-with-tc.json +1 -0
- data/spec/fixtures/v3/get-match.json +1 -0
- data/spec/fixtures/v3/get-matches-recent.json +1 -0
- data/spec/fixtures/v3/get-matches.json +1 -0
- data/spec/fixtures/v3/get-runes.json +1 -0
- data/spec/fixtures/v3/get-static-champions-by-id.json +1 -0
- data/spec/fixtures/v3/get-static-champions.json +1 -0
- data/spec/fixtures/v3/get-static-items-by-id.json +1 -0
- data/spec/fixtures/v3/get-static-items.json +1 -0
- data/spec/fixtures/v3/get-static-maps.json +1 -0
- data/spec/fixtures/v3/get-static-masteries-by-id.json +1 -0
- data/spec/fixtures/v3/get-static-masteries.json +1 -0
- data/spec/fixtures/v3/get-static-realms.json +1 -0
- data/spec/fixtures/v3/get-static-runes-by-id.json +1 -0
- data/spec/fixtures/v3/get-static-runes.json +1 -0
- data/spec/fixtures/v3/get-static-summoner-spells-by-id.json +1 -0
- data/spec/fixtures/v3/get-static-summoner-spells.json +1 -0
- data/spec/fixtures/v3/get-static-versions.json +1 -0
- data/spec/fixtures/v3/get-summoner-by-name.json +1 -0
- data/spec/fixtures/v3/get-summoner.json +1 -0
- data/spec/fixtures/v3/get-timeline.json +1 -0
- data/spec/fixtures/v3/get-tournament-code.json +1 -0
- data/spec/lol/champion_mastery_request_spec.rb +33 -133
- data/spec/lol/champion_request_spec.rb +17 -30
- data/spec/lol/client_spec.rb +12 -56
- data/spec/lol/league_request_spec.rb +29 -72
- data/spec/lol/lol_status_request_spec.rb +6 -34
- data/spec/lol/masteries_request_spec.rb +15 -0
- data/spec/lol/match_request_spec.rb +45 -10
- data/spec/lol/request_spec.rb +5 -5
- data/spec/lol/runes_request_spec.rb +15 -0
- data/spec/lol/spectator_request_spec.rb +23 -0
- data/spec/lol/static_request_spec.rb +44 -48
- data/spec/lol/summoner_request_spec.rb +20 -71
- data/spec/lol/tournament_request_spec.rb +36 -0
- metadata +92 -175
- data/lib/lol/champion.rb +0 -37
- data/lib/lol/champion_mastery.rb +0 -50
- data/lib/lol/champion_statistics_summary.rb +0 -25
- data/lib/lol/current_game_request.rb +0 -16
- data/lib/lol/featured_games_request.rb +0 -15
- data/lib/lol/game.rb +0 -85
- data/lib/lol/game_request.rb +0 -19
- data/lib/lol/league.rb +0 -32
- data/lib/lol/league_entry.rb +0 -74
- data/lib/lol/mastery.rb +0 -16
- data/lib/lol/mastery_page.rb +0 -28
- data/lib/lol/match_list_request.rb +0 -15
- data/lib/lol/match_summary.rb +0 -59
- data/lib/lol/mini_series.rb +0 -29
- data/lib/lol/model.rb +0 -28
- data/lib/lol/player.rb +0 -21
- data/lib/lol/player_statistic.rb +0 -46
- data/lib/lol/ranked_statistics_summary.rb +0 -35
- data/lib/lol/roster.rb +0 -23
- data/lib/lol/rune_page.rb +0 -28
- data/lib/lol/rune_slot.rb +0 -29
- data/lib/lol/stats_request.rb +0 -35
- data/lib/lol/summoner.rb +0 -36
- data/lib/lol/team.rb +0 -110
- data/lib/lol/team_member.rb +0 -33
- data/lib/lol/team_request.rb +0 -32
- data/lib/lol/team_statistic.rb +0 -53
- data/lib/lol/tournament_code.rb +0 -58
- data/lib/lol/tournament_provider_request.rb +0 -111
- data/spec/fixtures/v1.0/get-champion-mastery-top-champions-10.json +0 -121
- data/spec/fixtures/v1.0/get-champion-mastery-top-champions.json +0 -38
- data/spec/fixtures/v1.0/get-current-game.json +0 -1065
- data/spec/fixtures/v1.0/get-featured-games.json +0 -730
- data/spec/fixtures/v1.0/get-lol-status-shard-by-region.json +0 -39
- data/spec/fixtures/v1.0/get-lol-status-shards.json +0 -78
- data/spec/fixtures/v1.2/get-champion-by-id.json +0 -6
- data/spec/fixtures/v1.2/get-item-by-id.json +0 -6
- data/spec/fixtures/v1.2/get-item.json +0 -1563
- data/spec/fixtures/v1.2/get-mastery-by-id.json +0 -9
- data/spec/fixtures/v1.2/get-mastery.json +0 -389
- data/spec/fixtures/v1.2/get-realm.json +0 -1
- data/spec/fixtures/v1.2/get-rune-by-id.json +0 -26
- data/spec/fixtures/v1.2/get-rune.json +0 -2966
- data/spec/fixtures/v1.2/get-static-champion.json +0 -714
- data/spec/fixtures/v1.2/get-summoner-spell-by-id.json +0 -39
- data/spec/fixtures/v1.2/get-summoner-spell.json +0 -97
- data/spec/fixtures/v1.2/get-versions.json +0 -1
- data/spec/fixtures/v1.3/get-game.json +0 -1040
- data/spec/fixtures/v1.3/get-ranked_stats.json +0 -1
- data/spec/fixtures/v1.3/get-stats.json +0 -1
- data/spec/fixtures/v1.4/get-summoner-by-name.json +0 -1
- data/spec/fixtures/v1.4/get-summoner-masteries.json +0 -898
- data/spec/fixtures/v1.4/get-summoner-name.json +0 -1
- data/spec/fixtures/v1.4/get-summoner-runes.json +0 -2547
- data/spec/fixtures/v1.4/get-summoner.json +0 -1
- data/spec/fixtures/v2.2/get-match.json +0 -1
- data/spec/fixtures/v2.2/get-match_list.json +0 -1
- data/spec/fixtures/v2.4/get-by-summoner.json +0 -1
- data/spec/fixtures/v2.4/get-team.json +0 -1
- data/spec/fixtures/v2.5/get-league-by-team.json +0 -1
- data/spec/fixtures/v2.5/get-league-challenger.json +0 -1
- data/spec/fixtures/v2.5/get-league-entry-by-team.json +0 -1
- data/spec/fixtures/v2.5/get-league-entry.json +0 -1
- data/spec/fixtures/v2.5/get-league-master.json +0 -1
- data/spec/fixtures/v2.5/get-league.json +0 -1
- data/spec/lol/champion_mastery_spec.rb +0 -20
- data/spec/lol/champion_spec.rb +0 -19
- data/spec/lol/champion_statistics_summary_spec.rb +0 -38
- data/spec/lol/current_game_request_spec.rb +0 -47
- data/spec/lol/featured_games_request_spec.rb +0 -39
- data/spec/lol/game_request_spec.rb +0 -32
- data/spec/lol/game_spec.rb +0 -51
- data/spec/lol/league_entry_spec.rb +0 -51
- data/spec/lol/league_spec.rb +0 -31
- data/spec/lol/mastery_page_spec.rb +0 -29
- data/spec/lol/mastery_spec.rb +0 -17
- data/spec/lol/match_list_request_spec.rb +0 -39
- data/spec/lol/match_summary_spec.rb +0 -25
- data/spec/lol/mini_series_spec.rb +0 -25
- data/spec/lol/model_spec.rb +0 -13
- data/spec/lol/player_spec.rb +0 -19
- data/spec/lol/player_statistic_spec.rb +0 -44
- data/spec/lol/ranked_statistics_summary_spec.rb +0 -32
- data/spec/lol/roster_spec.rb +0 -24
- data/spec/lol/rune_page_spec.rb +0 -28
- data/spec/lol/rune_slot_spec.rb +0 -16
- data/spec/lol/stats_request_spec.rb +0 -93
- data/spec/lol/summoner_spec.rb +0 -20
- data/spec/lol/team_member_spec.rb +0 -27
- data/spec/lol/team_request_spec.rb +0 -47
- data/spec/lol/team_spec.rb +0 -54
- data/spec/lol/team_statistic_spec.rb +0 -20
- data/spec/lol/tournament_code_spec.rb +0 -20
- data/spec/lol/tournament_provider_request_spec.rb +0 -73
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require "lol"
|
|
3
|
-
|
|
4
|
-
include Lol
|
|
5
|
-
|
|
6
|
-
describe MatchSummary do
|
|
7
|
-
it_behaves_like 'Lol model' do
|
|
8
|
-
let(:valid_attributes) { { win: true } }
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
%w(assists deaths game_id game_mode invalid kills map_id opposing_team_kills opposing_team_name win).each do |attribute|
|
|
12
|
-
describe "#{attribute} attribute" do
|
|
13
|
-
it_behaves_like 'plain attribute' do
|
|
14
|
-
let(:attribute) { attribute }
|
|
15
|
-
let(:attribute_value) { 'asd' }
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
describe "date attribute" do
|
|
21
|
-
it_behaves_like 'time attribute' do
|
|
22
|
-
let(:attribute) { 'date' }
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require "lol"
|
|
3
|
-
|
|
4
|
-
include Lol
|
|
5
|
-
|
|
6
|
-
describe MiniSeries do
|
|
7
|
-
it "inherits from Lol::Model" do
|
|
8
|
-
expect(MiniSeries.ancestors[1]).to eq(Model)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
context "initialization" do
|
|
12
|
-
it_behaves_like 'Lol model' do
|
|
13
|
-
let(:valid_attributes) { { target: 3 } }
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
%w(target wins losses time_left_to_play_millis progress).each do |attribute|
|
|
17
|
-
describe "#{attribute} attribute" do
|
|
18
|
-
it_behaves_like 'plain attribute' do
|
|
19
|
-
let(:attribute) { attribute }
|
|
20
|
-
let(:attribute_value) { 'asd' }
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
data/spec/lol/model_spec.rb
DELETED
data/spec/lol/player_spec.rb
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require "lol"
|
|
2
|
-
require "spec_helper"
|
|
3
|
-
|
|
4
|
-
include Lol
|
|
5
|
-
|
|
6
|
-
describe Player do
|
|
7
|
-
it_behaves_like 'Lol model' do
|
|
8
|
-
let(:valid_attributes) { { team_id: 1 } }
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
%w(champion_id summoner_id team_id).each do |attribute|
|
|
12
|
-
describe "#{attribute} attribute" do
|
|
13
|
-
it_behaves_like 'plain attribute' do
|
|
14
|
-
let(:attribute) { attribute }
|
|
15
|
-
let(:attribute_value) { 'asd' }
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require "lol"
|
|
3
|
-
|
|
4
|
-
include Lol
|
|
5
|
-
|
|
6
|
-
describe PlayerStatistic do
|
|
7
|
-
it_behaves_like 'Lol model' do
|
|
8
|
-
let(:valid_attributes) { { wins: 1 } }
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
%w(aggregated_stats losses modify_date_str player_stat_summary_type wins).each do |attribute|
|
|
12
|
-
describe "#{attribute} attribute" do
|
|
13
|
-
it_behaves_like 'plain attribute' do
|
|
14
|
-
let(:attribute) { attribute }
|
|
15
|
-
let(:attribute_value) { 'asd' }
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
describe 'aggregated_stats attribute' do
|
|
21
|
-
it_behaves_like 'plain attribute' do
|
|
22
|
-
let(:attribute) { 'aggregated_stats' }
|
|
23
|
-
let(:attribute_value) { 'asd' }
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
context 'when is passed as an hash' do
|
|
27
|
-
subject { PlayerStatistic.new aggregated_stats: { 'FooBar' => 'baz' } }
|
|
28
|
-
|
|
29
|
-
it 'will convert the hash in an openstruct object' do
|
|
30
|
-
expect(subject.aggregated_stats).to be_a OpenStruct
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
it 'will convert each hash key in underscore' do
|
|
34
|
-
expect(subject.aggregated_stats.foo_bar).to eq 'baz'
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
describe 'modify_date attribute' do
|
|
40
|
-
it_behaves_like 'time attribute' do
|
|
41
|
-
let(:attribute) { 'modify_date' }
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require "lol"
|
|
3
|
-
|
|
4
|
-
include Lol
|
|
5
|
-
|
|
6
|
-
describe RankedStatisticsSummary do
|
|
7
|
-
it_behaves_like 'Lol model' do
|
|
8
|
-
let(:valid_attributes) { { summoner_id: 1 } }
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
%w(summoner_id modify_date_str).each do |attribute|
|
|
12
|
-
describe "#{attribute} attribute" do
|
|
13
|
-
it_behaves_like 'plain attribute' do
|
|
14
|
-
let(:attribute) { attribute }
|
|
15
|
-
let(:attribute_value) { 'asd' }
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
describe 'champions attribute' do
|
|
21
|
-
it_behaves_like 'collection attribute' do
|
|
22
|
-
let(:attribute) { 'champions' }
|
|
23
|
-
let(:attribute_class) { ChampionStatisticsSummary }
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
describe 'modify_date attribute' do
|
|
28
|
-
it_behaves_like 'time attribute' do
|
|
29
|
-
let(:attribute) { 'modify_date' }
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
data/spec/lol/roster_spec.rb
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require "lol"
|
|
3
|
-
|
|
4
|
-
include Lol
|
|
5
|
-
|
|
6
|
-
describe Roster do
|
|
7
|
-
it_behaves_like 'Lol model' do
|
|
8
|
-
let(:valid_attributes) { { owner_id: 1 } }
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
describe "owner_id attribute" do
|
|
12
|
-
it_behaves_like 'plain attribute' do
|
|
13
|
-
let(:attribute) { 'owner_id' }
|
|
14
|
-
let(:attribute_value) { 'asd' }
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
describe 'member_list attribute' do
|
|
19
|
-
it_behaves_like 'collection attribute' do
|
|
20
|
-
let(:attribute) { 'member_list' }
|
|
21
|
-
let(:attribute_class) { TeamMember }
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
data/spec/lol/rune_page_spec.rb
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require "lol"
|
|
3
|
-
|
|
4
|
-
include Lol
|
|
5
|
-
|
|
6
|
-
describe RunePage do
|
|
7
|
-
it_behaves_like 'Lol model' do
|
|
8
|
-
let(:valid_attributes) { { id: 1 } }
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
%w(id name current).each do |attribute|
|
|
12
|
-
it_behaves_like "plain attribute" do
|
|
13
|
-
let(:attribute) { attribute }
|
|
14
|
-
let(:attribute_value) { "asd" }
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
describe "#slots" do
|
|
19
|
-
let(:fixture) { load_fixture("summoner-runes", SummonerRequest.api_version) }
|
|
20
|
-
let(:slots) { fixture["30743211"]["pages"].first["slots"] }
|
|
21
|
-
|
|
22
|
-
subject { RunePage.new fixture["30743211"]["pages"].first }
|
|
23
|
-
|
|
24
|
-
it "is populated by all slots" do
|
|
25
|
-
expect(subject.slots.size).to eq(slots.size)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
data/spec/lol/rune_slot_spec.rb
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require "lol"
|
|
3
|
-
|
|
4
|
-
include Lol
|
|
5
|
-
|
|
6
|
-
describe RuneSlot do
|
|
7
|
-
it_behaves_like 'Lol model' do
|
|
8
|
-
let(:valid_attributes) { { id: 1 } }
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it_behaves_like "plain attribute" do
|
|
12
|
-
let(:attribute) { "id" }
|
|
13
|
-
let(:attribute_value) { "asd" }
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
end
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require "lol"
|
|
3
|
-
|
|
4
|
-
include Lol
|
|
5
|
-
|
|
6
|
-
describe StatsRequest do
|
|
7
|
-
let(:request) { StatsRequest.new("api_key", "euw") }
|
|
8
|
-
|
|
9
|
-
it "inherits from Request" do
|
|
10
|
-
expect(StatsRequest.ancestors[1]).to eq(Request)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe "#summary" do
|
|
14
|
-
|
|
15
|
-
it 'requires a summoner' do
|
|
16
|
-
expect { request.summary }.to raise_error ArgumentError
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it 'raises an error when unexpected parameter is received' do
|
|
20
|
-
expect { request.summary '1', asd: 'foo' }.to raise_error ArgumentError
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
context 'with summoner' do
|
|
24
|
-
subject { request.summary(1) }
|
|
25
|
-
|
|
26
|
-
context 'without season' do
|
|
27
|
-
let(:fixture) { load_fixture('stats', StatsRequest.api_version) }
|
|
28
|
-
|
|
29
|
-
before(:each) { stub_request(request, 'stats', 'stats/by-summoner/1/summary') }
|
|
30
|
-
|
|
31
|
-
it 'returns an array' do
|
|
32
|
-
expect(subject).to be_a Array
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it 'returns an array of PlayerStatistic' do
|
|
36
|
-
expect(subject.map(&:class).uniq).to eq [PlayerStatistic]
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
it 'fetches PlayerStatistics from the API' do
|
|
40
|
-
expect(subject.size).to eq(fixture['playerStatSummaries'].size)
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
context 'with season' do
|
|
45
|
-
before(:each) { stub_request(request, 'stats', 'stats/by-summoner/1/summary', season: '1') }
|
|
46
|
-
|
|
47
|
-
it 'optionally accepts a season' do
|
|
48
|
-
request.summary('1', season: '1')
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
describe "#ranked" do
|
|
56
|
-
|
|
57
|
-
it 'requires a summoner' do
|
|
58
|
-
expect { request.ranked }.to raise_error ArgumentError
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
it 'raises an error when unexpected parameter is received' do
|
|
62
|
-
expect { request.ranked '1', asd: 'foo' }.to raise_error ArgumentError
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
context 'with summoner' do
|
|
66
|
-
let(:fixture) { load_fixture('ranked_stats', StatsRequest.api_version) }
|
|
67
|
-
|
|
68
|
-
context 'without season' do
|
|
69
|
-
subject { request.ranked(1) }
|
|
70
|
-
|
|
71
|
-
before(:each) { stub_request(request, 'ranked_stats', 'stats/by-summoner/1/ranked') }
|
|
72
|
-
|
|
73
|
-
it 'returns a RankedStatisticsSummary' do
|
|
74
|
-
expect(subject).to be_a RankedStatisticsSummary
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
it 'fetches RankedStatisticsSummary from the API' do
|
|
78
|
-
expect(subject.champions.size).to eq(fixture['champions'].size)
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
context 'with season' do
|
|
83
|
-
before(:each) { stub_request(request, 'ranked_stats', 'stats/by-summoner/1/ranked', season: '1') }
|
|
84
|
-
|
|
85
|
-
it 'optionally accepts a season' do
|
|
86
|
-
request.ranked('1', season: '1')
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
end
|
data/spec/lol/summoner_spec.rb
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require "lol"
|
|
3
|
-
|
|
4
|
-
include Lol
|
|
5
|
-
|
|
6
|
-
describe Summoner do
|
|
7
|
-
it_behaves_like 'Lol model' do
|
|
8
|
-
let(:valid_attributes) { { id: 1 } }
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
%w(id name profile_icon_id revision_date revision_date_str summoner_level).each do |attribute|
|
|
12
|
-
describe "#{attribute} attribute" do
|
|
13
|
-
it_behaves_like 'plain attribute' do
|
|
14
|
-
let(:attribute) { attribute }
|
|
15
|
-
let(:attribute_value) { 'asd' }
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require "lol"
|
|
3
|
-
|
|
4
|
-
include Lol
|
|
5
|
-
|
|
6
|
-
describe TeamMember do
|
|
7
|
-
it_behaves_like 'Lol model' do
|
|
8
|
-
let(:valid_attributes) { { player_id: 1 } }
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
%w(player_id status).each do |attribute|
|
|
12
|
-
describe "#{attribute} attribute" do
|
|
13
|
-
it_behaves_like 'plain attribute' do
|
|
14
|
-
let(:attribute) { attribute }
|
|
15
|
-
let(:attribute_value) { 'asd' }
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
%w(invite_date join_date).each do |attribute|
|
|
21
|
-
describe "#{attribute} attribute" do
|
|
22
|
-
it_behaves_like 'time attribute' do
|
|
23
|
-
let(:attribute) { attribute }
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require "lol"
|
|
3
|
-
|
|
4
|
-
include Lol
|
|
5
|
-
|
|
6
|
-
describe TeamRequest do
|
|
7
|
-
let(:request) { TeamRequest.new("api_key", "euw") }
|
|
8
|
-
|
|
9
|
-
it "inherits from Request" do
|
|
10
|
-
expect(TeamRequest.ancestors[1]).to eq(Request)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe "#by_summoner" do
|
|
14
|
-
let(:fixture) { load_fixture('by-summoner', TeamRequest.api_version) }
|
|
15
|
-
|
|
16
|
-
subject { request.by_summoner(1) }
|
|
17
|
-
|
|
18
|
-
before(:each) { stub_request(request, 'by-summoner', 'team/by-summoner/1') }
|
|
19
|
-
|
|
20
|
-
it 'returns an hash' do
|
|
21
|
-
expect(subject).to be_a(Hash)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
it 'fetches Team from the API' do
|
|
25
|
-
expect(subject.size).to eq(fixture.size)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
describe "#get" do
|
|
30
|
-
|
|
31
|
-
it 'requires a team id' do
|
|
32
|
-
expect { request.get }.to raise_error(VCR::Errors::UnhandledHTTPRequestError)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
context 'with team id' do
|
|
36
|
-
subject { request.get("TEAM-a9ad3db0-b377-11e3-b87d-782bcb4ce61a") }
|
|
37
|
-
|
|
38
|
-
before(:each) { stub_request(request, 'team', 'team/TEAM-a9ad3db0-b377-11e3-b87d-782bcb4ce61a') }
|
|
39
|
-
|
|
40
|
-
it 'returns an array of Teams' do
|
|
41
|
-
subject.each {|k,v| expect(v).to be_a Lol::Team}
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
end
|
data/spec/lol/team_spec.rb
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require "lol"
|
|
3
|
-
|
|
4
|
-
include Lol
|
|
5
|
-
|
|
6
|
-
describe Team do
|
|
7
|
-
it_behaves_like 'Lol model' do
|
|
8
|
-
let(:valid_attributes) { { } }
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
%w(full_id name status tag).each do |attribute|
|
|
12
|
-
describe "#{attribute} attribute" do
|
|
13
|
-
it_behaves_like 'plain attribute' do
|
|
14
|
-
let(:attribute) { attribute }
|
|
15
|
-
let(:attribute_value) { 'asd' }
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
%w(create_date last_game_date last_join_date second_last_join_date third_last_join_date last_joined_ranked_team_queue_date modify_date).each do |attribute|
|
|
21
|
-
describe "#{attribute} attribute" do
|
|
22
|
-
it_behaves_like 'time attribute' do
|
|
23
|
-
let(:attribute) { attribute }
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
describe 'match_history attribute' do
|
|
29
|
-
it_behaves_like 'collection attribute' do
|
|
30
|
-
let(:attribute) { 'match_history' }
|
|
31
|
-
let(:attribute_class) { MatchSummary }
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
describe 'team_stat_details attribute' do
|
|
36
|
-
it_behaves_like 'collection attribute' do
|
|
37
|
-
let(:attribute) { 'team_stat_details' }
|
|
38
|
-
let(:attribute_class) { TeamStatistic }
|
|
39
|
-
let(:attribute_value) { { 'teamStatDetails' => [{}, {}] } }
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
describe 'roster attribute' do
|
|
44
|
-
it_behaves_like 'plain attribute' do
|
|
45
|
-
let(:attribute) { 'create_date' }
|
|
46
|
-
let(:attribute_value) { 'asd' }
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
it 'parses the value if it is an Hash' do
|
|
50
|
-
model = Team.new roster: {}
|
|
51
|
-
expect(model.roster).to be_a Roster
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|