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.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +16 -0
  3. data/.gitignore +2 -0
  4. data/.rspec +1 -0
  5. data/.rubocop.yml +1157 -0
  6. data/.travis.yml +1 -1
  7. data/lib/lol/champion_mastery_request.rb +29 -57
  8. data/lib/lol/champion_request.rb +19 -23
  9. data/lib/lol/client.rb +16 -21
  10. data/lib/lol/dynamic_model.rb +14 -5
  11. data/lib/lol/featured_game_list.rb +15 -0
  12. data/lib/lol/league_request.rb +28 -49
  13. data/lib/lol/lol_status_request.rb +9 -26
  14. data/lib/lol/masteries_request.rb +14 -0
  15. data/lib/lol/match_request.rb +51 -9
  16. data/lib/lol/request.rb +55 -21
  17. data/lib/lol/runes_request.rb +14 -0
  18. data/lib/lol/spectator_request.rb +24 -0
  19. data/lib/lol/static_request.rb +34 -23
  20. data/lib/lol/summoner_request.rb +22 -51
  21. data/lib/lol/tournament_request.rb +95 -0
  22. data/lib/lol/version.rb +1 -1
  23. data/ruby-lol.gemspec +1 -1
  24. data/spec/api_version_spec.rb +10 -9
  25. data/spec/fixtures/{v1.2 → v3}/get-champion-266.json +0 -0
  26. data/spec/fixtures/{v1.2/get-champion.json → v3/get-champion-all.json} +0 -0
  27. data/spec/fixtures/{v1.0/get-champion-mastery-champions.json → v3/get-champion-masteries.json} +0 -0
  28. data/spec/fixtures/{v1.0/get-champion-mastery-champion.json → v3/get-champion-mastery.json} +0 -0
  29. data/spec/fixtures/v3/get-current-game.json +1 -0
  30. data/spec/fixtures/v3/get-featured-games.json +1 -0
  31. data/spec/fixtures/v3/get-ids-by-tc.json +1 -0
  32. data/spec/fixtures/v3/get-league-challenger.json +1 -0
  33. data/spec/fixtures/v3/get-league-master.json +1 -0
  34. data/spec/fixtures/v3/get-league-positions.json +1 -0
  35. data/spec/fixtures/v3/get-league-summoner.json +1 -0
  36. data/spec/fixtures/v3/get-lol-status-shard.json +1 -0
  37. data/spec/fixtures/v3/get-masteries.json +1 -0
  38. data/spec/fixtures/v3/get-match-with-tc.json +1 -0
  39. data/spec/fixtures/v3/get-match.json +1 -0
  40. data/spec/fixtures/v3/get-matches-recent.json +1 -0
  41. data/spec/fixtures/v3/get-matches.json +1 -0
  42. data/spec/fixtures/v3/get-runes.json +1 -0
  43. data/spec/fixtures/v3/get-static-champions-by-id.json +1 -0
  44. data/spec/fixtures/v3/get-static-champions.json +1 -0
  45. data/spec/fixtures/v3/get-static-items-by-id.json +1 -0
  46. data/spec/fixtures/v3/get-static-items.json +1 -0
  47. data/spec/fixtures/v3/get-static-maps.json +1 -0
  48. data/spec/fixtures/v3/get-static-masteries-by-id.json +1 -0
  49. data/spec/fixtures/v3/get-static-masteries.json +1 -0
  50. data/spec/fixtures/v3/get-static-realms.json +1 -0
  51. data/spec/fixtures/v3/get-static-runes-by-id.json +1 -0
  52. data/spec/fixtures/v3/get-static-runes.json +1 -0
  53. data/spec/fixtures/v3/get-static-summoner-spells-by-id.json +1 -0
  54. data/spec/fixtures/v3/get-static-summoner-spells.json +1 -0
  55. data/spec/fixtures/v3/get-static-versions.json +1 -0
  56. data/spec/fixtures/v3/get-summoner-by-name.json +1 -0
  57. data/spec/fixtures/v3/get-summoner.json +1 -0
  58. data/spec/fixtures/v3/get-timeline.json +1 -0
  59. data/spec/fixtures/v3/get-tournament-code.json +1 -0
  60. data/spec/lol/champion_mastery_request_spec.rb +33 -133
  61. data/spec/lol/champion_request_spec.rb +17 -30
  62. data/spec/lol/client_spec.rb +12 -56
  63. data/spec/lol/league_request_spec.rb +29 -72
  64. data/spec/lol/lol_status_request_spec.rb +6 -34
  65. data/spec/lol/masteries_request_spec.rb +15 -0
  66. data/spec/lol/match_request_spec.rb +45 -10
  67. data/spec/lol/request_spec.rb +5 -5
  68. data/spec/lol/runes_request_spec.rb +15 -0
  69. data/spec/lol/spectator_request_spec.rb +23 -0
  70. data/spec/lol/static_request_spec.rb +44 -48
  71. data/spec/lol/summoner_request_spec.rb +20 -71
  72. data/spec/lol/tournament_request_spec.rb +36 -0
  73. metadata +92 -175
  74. data/lib/lol/champion.rb +0 -37
  75. data/lib/lol/champion_mastery.rb +0 -50
  76. data/lib/lol/champion_statistics_summary.rb +0 -25
  77. data/lib/lol/current_game_request.rb +0 -16
  78. data/lib/lol/featured_games_request.rb +0 -15
  79. data/lib/lol/game.rb +0 -85
  80. data/lib/lol/game_request.rb +0 -19
  81. data/lib/lol/league.rb +0 -32
  82. data/lib/lol/league_entry.rb +0 -74
  83. data/lib/lol/mastery.rb +0 -16
  84. data/lib/lol/mastery_page.rb +0 -28
  85. data/lib/lol/match_list_request.rb +0 -15
  86. data/lib/lol/match_summary.rb +0 -59
  87. data/lib/lol/mini_series.rb +0 -29
  88. data/lib/lol/model.rb +0 -28
  89. data/lib/lol/player.rb +0 -21
  90. data/lib/lol/player_statistic.rb +0 -46
  91. data/lib/lol/ranked_statistics_summary.rb +0 -35
  92. data/lib/lol/roster.rb +0 -23
  93. data/lib/lol/rune_page.rb +0 -28
  94. data/lib/lol/rune_slot.rb +0 -29
  95. data/lib/lol/stats_request.rb +0 -35
  96. data/lib/lol/summoner.rb +0 -36
  97. data/lib/lol/team.rb +0 -110
  98. data/lib/lol/team_member.rb +0 -33
  99. data/lib/lol/team_request.rb +0 -32
  100. data/lib/lol/team_statistic.rb +0 -53
  101. data/lib/lol/tournament_code.rb +0 -58
  102. data/lib/lol/tournament_provider_request.rb +0 -111
  103. data/spec/fixtures/v1.0/get-champion-mastery-top-champions-10.json +0 -121
  104. data/spec/fixtures/v1.0/get-champion-mastery-top-champions.json +0 -38
  105. data/spec/fixtures/v1.0/get-current-game.json +0 -1065
  106. data/spec/fixtures/v1.0/get-featured-games.json +0 -730
  107. data/spec/fixtures/v1.0/get-lol-status-shard-by-region.json +0 -39
  108. data/spec/fixtures/v1.0/get-lol-status-shards.json +0 -78
  109. data/spec/fixtures/v1.2/get-champion-by-id.json +0 -6
  110. data/spec/fixtures/v1.2/get-item-by-id.json +0 -6
  111. data/spec/fixtures/v1.2/get-item.json +0 -1563
  112. data/spec/fixtures/v1.2/get-mastery-by-id.json +0 -9
  113. data/spec/fixtures/v1.2/get-mastery.json +0 -389
  114. data/spec/fixtures/v1.2/get-realm.json +0 -1
  115. data/spec/fixtures/v1.2/get-rune-by-id.json +0 -26
  116. data/spec/fixtures/v1.2/get-rune.json +0 -2966
  117. data/spec/fixtures/v1.2/get-static-champion.json +0 -714
  118. data/spec/fixtures/v1.2/get-summoner-spell-by-id.json +0 -39
  119. data/spec/fixtures/v1.2/get-summoner-spell.json +0 -97
  120. data/spec/fixtures/v1.2/get-versions.json +0 -1
  121. data/spec/fixtures/v1.3/get-game.json +0 -1040
  122. data/spec/fixtures/v1.3/get-ranked_stats.json +0 -1
  123. data/spec/fixtures/v1.3/get-stats.json +0 -1
  124. data/spec/fixtures/v1.4/get-summoner-by-name.json +0 -1
  125. data/spec/fixtures/v1.4/get-summoner-masteries.json +0 -898
  126. data/spec/fixtures/v1.4/get-summoner-name.json +0 -1
  127. data/spec/fixtures/v1.4/get-summoner-runes.json +0 -2547
  128. data/spec/fixtures/v1.4/get-summoner.json +0 -1
  129. data/spec/fixtures/v2.2/get-match.json +0 -1
  130. data/spec/fixtures/v2.2/get-match_list.json +0 -1
  131. data/spec/fixtures/v2.4/get-by-summoner.json +0 -1
  132. data/spec/fixtures/v2.4/get-team.json +0 -1
  133. data/spec/fixtures/v2.5/get-league-by-team.json +0 -1
  134. data/spec/fixtures/v2.5/get-league-challenger.json +0 -1
  135. data/spec/fixtures/v2.5/get-league-entry-by-team.json +0 -1
  136. data/spec/fixtures/v2.5/get-league-entry.json +0 -1
  137. data/spec/fixtures/v2.5/get-league-master.json +0 -1
  138. data/spec/fixtures/v2.5/get-league.json +0 -1
  139. data/spec/lol/champion_mastery_spec.rb +0 -20
  140. data/spec/lol/champion_spec.rb +0 -19
  141. data/spec/lol/champion_statistics_summary_spec.rb +0 -38
  142. data/spec/lol/current_game_request_spec.rb +0 -47
  143. data/spec/lol/featured_games_request_spec.rb +0 -39
  144. data/spec/lol/game_request_spec.rb +0 -32
  145. data/spec/lol/game_spec.rb +0 -51
  146. data/spec/lol/league_entry_spec.rb +0 -51
  147. data/spec/lol/league_spec.rb +0 -31
  148. data/spec/lol/mastery_page_spec.rb +0 -29
  149. data/spec/lol/mastery_spec.rb +0 -17
  150. data/spec/lol/match_list_request_spec.rb +0 -39
  151. data/spec/lol/match_summary_spec.rb +0 -25
  152. data/spec/lol/mini_series_spec.rb +0 -25
  153. data/spec/lol/model_spec.rb +0 -13
  154. data/spec/lol/player_spec.rb +0 -19
  155. data/spec/lol/player_statistic_spec.rb +0 -44
  156. data/spec/lol/ranked_statistics_summary_spec.rb +0 -32
  157. data/spec/lol/roster_spec.rb +0 -24
  158. data/spec/lol/rune_page_spec.rb +0 -28
  159. data/spec/lol/rune_slot_spec.rb +0 -16
  160. data/spec/lol/stats_request_spec.rb +0 -93
  161. data/spec/lol/summoner_spec.rb +0 -20
  162. data/spec/lol/team_member_spec.rb +0 -27
  163. data/spec/lol/team_request_spec.rb +0 -47
  164. data/spec/lol/team_spec.rb +0 -54
  165. data/spec/lol/team_statistic_spec.rb +0 -20
  166. data/spec/lol/tournament_code_spec.rb +0 -20
  167. 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