ruby-lol 0.12.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,20 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "lol"
|
3
|
-
|
4
|
-
include Lol
|
5
|
-
|
6
|
-
describe TeamStatistic do
|
7
|
-
it_behaves_like 'Lol model' do
|
8
|
-
let(:valid_attributes) { { losses: 1 } }
|
9
|
-
end
|
10
|
-
|
11
|
-
%w(full_id average_games_played losses max_rating rating seed_rating team_stat_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
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "lol"
|
3
|
-
|
4
|
-
include Lol
|
5
|
-
|
6
|
-
describe TournamentCode do
|
7
|
-
it_behaves_like 'Lol model' do
|
8
|
-
let(:valid_attributes) { { } }
|
9
|
-
end
|
10
|
-
|
11
|
-
%w(id provider_id tournament_id code region map
|
12
|
-
team_size spectators pick_type lobby_name password).each do |attribute|
|
13
|
-
describe "#{attribute} attribute" do
|
14
|
-
it_behaves_like 'plain attribute' do
|
15
|
-
let(:attribute) { attribute }
|
16
|
-
let(:attribute_value) { 'asd' }
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,73 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "lol"
|
3
|
-
|
4
|
-
include Lol
|
5
|
-
|
6
|
-
describe TournamentProviderRequest do
|
7
|
-
it "inherits from Request" do
|
8
|
-
expect(TournamentProviderRequest.ancestors[1]).to eq(Request)
|
9
|
-
end
|
10
|
-
|
11
|
-
let(:request) { TournamentProviderRequest.new("api_key", "euw") }
|
12
|
-
|
13
|
-
describe "#api_url" do
|
14
|
-
subject { request.api_url "foo/bar"}
|
15
|
-
|
16
|
-
it "matches the tournament api paths" do
|
17
|
-
expect(subject).to eq("https://global.api.pvp.net/tournament/public/#{TournamentProviderRequest.api_version}/foo/bar")
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe "#provider" do
|
22
|
-
subject { request.provider("EUW", "https://foo.com") }
|
23
|
-
|
24
|
-
before(:each) do
|
25
|
-
expect(TournamentProviderRequest).to receive(:perform_request).and_return 10
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'return the provider id' do
|
29
|
-
expect(subject).to eq 10
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "#tournament" do
|
34
|
-
subject { request.provider("test", 10) }
|
35
|
-
|
36
|
-
before(:each) do
|
37
|
-
expect(TournamentProviderRequest).to receive(:perform_request).and_return 20
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'return the tournament provider id' do
|
41
|
-
expect(subject).to eq 20
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe "#get_code" do
|
46
|
-
# Can't use stub_request for different api_url
|
47
|
-
before(:each) do
|
48
|
-
full_url = request.api_url "code/CODE-FOR-TEST?#{request.api_query_string}"
|
49
|
-
fixture_json = load_fixture('get-code', TournamentProviderRequest.api_version)
|
50
|
-
|
51
|
-
expect(TournamentProviderRequest).to receive(:get).with(full_url, instance_of(Hash)).and_return(fixture_json)
|
52
|
-
end
|
53
|
-
subject { request.get_code "CODE-FOR-TEST" }
|
54
|
-
|
55
|
-
it 'returns a TournamentCode' do
|
56
|
-
expect(subject).to be_a(Lol::TournamentCode)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe "#update_code" do
|
61
|
-
let(:fixture) { load_fixture('get-code', TournamentProviderRequest.api_version) }
|
62
|
-
|
63
|
-
it 'exclude nil options' do
|
64
|
-
expect(request).to receive(:perform_request).once.ordered.with(
|
65
|
-
instance_of(String),
|
66
|
-
:put,
|
67
|
-
{ allowedParticipants: "1,2,3,4,5,6,7,8,9,10" }
|
68
|
-
)
|
69
|
-
expect(request).to receive(:perform_request).once.ordered.with(instance_of(String)).and_return(fixture)
|
70
|
-
request.update_code "CODE-FOR-TEST", { allowed_participants: [1,2,3,4,5,6,7,8,9,10] }
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|