riot_lol_api 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +5 -0
  4. data/.travis.yml +6 -0
  5. data/README.md +11 -6
  6. data/Rakefile +6 -1
  7. data/curl_import.rb +142 -123
  8. data/lib/core_ext/hash/riot_lol_api.rb +49 -0
  9. data/lib/core_ext/string/riot_lol_api.rb +9 -0
  10. data/lib/riot_lol_api.rb +15 -12
  11. data/lib/riot_lol_api/clients.rb +58 -325
  12. data/lib/riot_lol_api/{model/players.rb → concerns/inits.rb} +2 -3
  13. data/lib/riot_lol_api/helper_classes.rb +2 -5
  14. data/lib/riot_lol_api/models.rb +5 -3
  15. data/lib/riot_lol_api/models/aggregated_stats.rb +7 -0
  16. data/lib/riot_lol_api/models/altimages.rb +7 -0
  17. data/lib/riot_lol_api/models/banned_champions.rb +7 -0
  18. data/lib/riot_lol_api/models/bans.rb +7 -0
  19. data/lib/riot_lol_api/models/blocks.rb +9 -0
  20. data/lib/riot_lol_api/models/champion_masteries.rb +7 -0
  21. data/lib/riot_lol_api/models/champions.rb +16 -0
  22. data/lib/riot_lol_api/models/class_base.rb +7 -0
  23. data/lib/riot_lol_api/models/creepspermindeltas.rb +7 -0
  24. data/lib/riot_lol_api/models/csdiffpermindeltas.rb +7 -0
  25. data/lib/riot_lol_api/models/damagetakendiffpermindeltas.rb +7 -0
  26. data/lib/riot_lol_api/models/damagetakenpermindeltas.rb +7 -0
  27. data/lib/riot_lol_api/models/data.rb +7 -0
  28. data/lib/riot_lol_api/models/effects.rb +7 -0
  29. data/lib/riot_lol_api/models/entries.rb +7 -0
  30. data/lib/riot_lol_api/models/fellow_players.rb +7 -0
  31. data/lib/riot_lol_api/models/game_lists.rb +7 -0
  32. data/lib/riot_lol_api/models/games.rb +12 -0
  33. data/lib/riot_lol_api/models/goldpermindeltas.rb +7 -0
  34. data/lib/riot_lol_api/models/golds.rb +7 -0
  35. data/lib/riot_lol_api/models/images.rb +17 -0
  36. data/lib/riot_lol_api/models/infos.rb +7 -0
  37. data/lib/riot_lol_api/models/items.rb +11 -0
  38. data/lib/riot_lol_api/models/leagues.rb +10 -0
  39. data/lib/riot_lol_api/models/leveltips.rb +7 -0
  40. data/lib/riot_lol_api/{model → models}/maps.rb +4 -7
  41. data/lib/riot_lol_api/models/masteries.rb +14 -0
  42. data/lib/riot_lol_api/models/matches.rb +11 -0
  43. data/lib/riot_lol_api/models/mini_series.rb +7 -0
  44. data/lib/riot_lol_api/models/observers.rb +7 -0
  45. data/lib/riot_lol_api/models/pages.rb +11 -0
  46. data/lib/riot_lol_api/models/participantidentities.rb +7 -0
  47. data/lib/riot_lol_api/models/participants.rb +7 -0
  48. data/lib/riot_lol_api/models/passives.rb +9 -0
  49. data/lib/riot_lol_api/models/player_stat_ranks.rb +9 -0
  50. data/lib/riot_lol_api/models/player_stat_summaries.rb +9 -0
  51. data/lib/riot_lol_api/models/players.rb +7 -0
  52. data/lib/riot_lol_api/models/recommendeds.rb +9 -0
  53. data/lib/riot_lol_api/models/runes.rb +7 -0
  54. data/lib/riot_lol_api/models/skins.rb +7 -0
  55. data/lib/riot_lol_api/models/slots.rb +9 -0
  56. data/lib/riot_lol_api/models/spells.rb +12 -0
  57. data/lib/riot_lol_api/{model → models}/stats.rb +3 -10
  58. data/lib/riot_lol_api/models/summoners.rb +110 -0
  59. data/lib/riot_lol_api/models/teams.rb +11 -0
  60. data/lib/riot_lol_api/models/timelines.rb +9 -0
  61. data/lib/riot_lol_api/models/vars.rb +7 -0
  62. data/lib/riot_lol_api/models/xpdiffpermindeltas.rb +7 -0
  63. data/lib/riot_lol_api/models/xppermindeltas.rb +7 -0
  64. data/lib/riot_lol_api/requests/champion_masteries.rb +11 -0
  65. data/lib/riot_lol_api/requests/champions.rb +23 -0
  66. data/lib/riot_lol_api/requests/games.rb +23 -0
  67. data/lib/riot_lol_api/requests/items.rb +23 -0
  68. data/lib/riot_lol_api/requests/masteries.rb +23 -0
  69. data/lib/riot_lol_api/requests/runes.rb +23 -0
  70. data/lib/riot_lol_api/requests/spells.rb +23 -0
  71. data/lib/riot_lol_api/requests/summoners.rb +29 -0
  72. data/lib/riot_lol_api/supports/regions.rb +33 -0
  73. data/lib/riot_lol_api/version.rb +1 -1
  74. data/riot_lol_api.gemspec +19 -16
  75. data/spec/factories/champion.rb +8 -8
  76. data/spec/factories/client.rb +7 -5
  77. data/spec/factories/game.rb +18 -18
  78. data/spec/factories/page.rb +8 -8
  79. data/spec/factories/summoner.rb +10 -9
  80. data/spec/mock_response/championmastery_by_summoner.json +7 -0
  81. data/spec/mock_response/championmastery_by_summoner_by_champion.json +7 -0
  82. data/spec/mock_response/championmastery_score.json +7 -0
  83. data/spec/mock_response/championmastery_top.json +7 -0
  84. data/spec/mock_response/get_all_champions_by_ids.json +4 -5
  85. data/spec/mock_response/get_all_champions_by_ids_all_data.json +4 -5
  86. data/spec/mock_response/get_all_item.json +4 -5
  87. data/spec/mock_response/get_all_masteries.json +5 -6
  88. data/spec/mock_response/get_all_runes.json +4 -5
  89. data/spec/mock_response/get_all_summoner_spells.json +5 -6
  90. data/spec/mock_response/get_all_summoner_spells_by_ids.json +4 -5
  91. data/spec/mock_response/get_champion_by_id.json +3 -4
  92. data/spec/mock_response/get_champion_by_id_all_data.json +4 -5
  93. data/spec/mock_response/get_featured_games.json +7 -7
  94. data/spec/mock_response/get_item_by_id.json +5 -6
  95. data/spec/mock_response/get_mastery_by_id.json +5 -6
  96. data/spec/mock_response/get_match_by_id.json +4 -5
  97. data/spec/mock_response/get_player_league.json +5 -6
  98. data/spec/mock_response/get_player_stat_ranked.json +5 -6
  99. data/spec/mock_response/get_player_stat_summaries.json +5 -6
  100. data/spec/mock_response/get_realm.json +5 -5
  101. data/spec/mock_response/get_rune_by_id.json +4 -5
  102. data/spec/mock_response/get_summoner_by_id.json +5 -6
  103. data/spec/mock_response/get_summoner_by_name.json +5 -6
  104. data/spec/mock_response/get_summoner_games_by_id.json +5 -6
  105. data/spec/mock_response/get_summoner_masteries_by_id.json +5 -6
  106. data/spec/mock_response/get_summoner_runes_by_id.json +5 -6
  107. data/spec/mock_response/get_summoner_spell_by_id.json +5 -6
  108. data/spec/mock_response/get_version.json +5 -6
  109. data/spec/mock_response/match_list.json +12 -0
  110. data/spec/mock_response/realm.json +12 -0
  111. data/spec/mock_response/summoner.json +5 -6
  112. data/spec/{riot_lol_api_spec.rb → riot_lol_api/riot_lol_api_spec.rb} +135 -164
  113. data/spec/riot_lol_api/riot_lol_api_supports_spec.rb +8 -0
  114. data/spec/spec_helper.rb +7 -2
  115. metadata +144 -77
  116. data/lib/core_ext/hash.rb +0 -29
  117. data/lib/core_ext/string.rb +0 -5
  118. data/lib/riot_lol_api/model/aggregated_stats.rb +0 -14
  119. data/lib/riot_lol_api/model/altimages.rb +0 -14
  120. data/lib/riot_lol_api/model/banned_champions.rb +0 -14
  121. data/lib/riot_lol_api/model/bans.rb +0 -14
  122. data/lib/riot_lol_api/model/blocks.rb +0 -16
  123. data/lib/riot_lol_api/model/champions.rb +0 -23
  124. data/lib/riot_lol_api/model/class_base.rb +0 -14
  125. data/lib/riot_lol_api/model/creepspermindeltas.rb +0 -14
  126. data/lib/riot_lol_api/model/csdiffpermindeltas.rb +0 -14
  127. data/lib/riot_lol_api/model/damagetakendiffpermindeltas.rb +0 -13
  128. data/lib/riot_lol_api/model/damagetakenpermindeltas.rb +0 -14
  129. data/lib/riot_lol_api/model/data.rb +0 -14
  130. data/lib/riot_lol_api/model/effects.rb +0 -14
  131. data/lib/riot_lol_api/model/entries.rb +0 -14
  132. data/lib/riot_lol_api/model/fellow_players.rb +0 -14
  133. data/lib/riot_lol_api/model/game_lists.rb +0 -14
  134. data/lib/riot_lol_api/model/games.rb +0 -19
  135. data/lib/riot_lol_api/model/goldpermindeltas.rb +0 -14
  136. data/lib/riot_lol_api/model/golds.rb +0 -14
  137. data/lib/riot_lol_api/model/images.rb +0 -24
  138. data/lib/riot_lol_api/model/infos.rb +0 -14
  139. data/lib/riot_lol_api/model/items.rb +0 -18
  140. data/lib/riot_lol_api/model/leagues.rb +0 -17
  141. data/lib/riot_lol_api/model/leveltips.rb +0 -14
  142. data/lib/riot_lol_api/model/masteries.rb +0 -30
  143. data/lib/riot_lol_api/model/matches.rb +0 -18
  144. data/lib/riot_lol_api/model/mini_series.rb +0 -14
  145. data/lib/riot_lol_api/model/observers.rb +0 -14
  146. data/lib/riot_lol_api/model/pages.rb +0 -18
  147. data/lib/riot_lol_api/model/participantidentities.rb +0 -13
  148. data/lib/riot_lol_api/model/participants.rb +0 -14
  149. data/lib/riot_lol_api/model/passives.rb +0 -16
  150. data/lib/riot_lol_api/model/player_stat_ranks.rb +0 -16
  151. data/lib/riot_lol_api/model/player_stat_summaries.rb +0 -16
  152. data/lib/riot_lol_api/model/recommendeds.rb +0 -16
  153. data/lib/riot_lol_api/model/runes.rb +0 -14
  154. data/lib/riot_lol_api/model/skins.rb +0 -14
  155. data/lib/riot_lol_api/model/slots.rb +0 -16
  156. data/lib/riot_lol_api/model/spells.rb +0 -19
  157. data/lib/riot_lol_api/model/summoners.rb +0 -160
  158. data/lib/riot_lol_api/model/teams.rb +0 -18
  159. data/lib/riot_lol_api/model/timelines.rb +0 -16
  160. data/lib/riot_lol_api/model/vars.rb +0 -14
  161. data/lib/riot_lol_api/model/xpdiffpermindeltas.rb +0 -14
  162. data/lib/riot_lol_api/model/xppermindeltas.rb +0 -14
  163. data/spec/mock_response/get_match_history.json +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75c6f27bdeed2052301f7f5f39794e78725988aa
4
- data.tar.gz: 5f6888386b098d2bd10d053e39d10edaa825bbc8
3
+ metadata.gz: e75080a4edfe0e84ada85a331308a03ca1772bff
4
+ data.tar.gz: 3bcc1d81c40fc7b2d8e4d633ea47cf587290ffab
5
5
  SHA512:
6
- metadata.gz: b7014966dc977243a2872d5704f83790500188225fc1cafced42d451a710b5ffd94e864ae4ce8c3c4352dc0d71508a223164d8d1f3b465385f1b9a698da7926f
7
- data.tar.gz: ed201bda5e9ad41fa29682e25a38f66c263bb9111ca28073b92321d5e525e6fd202bb376a445c1765d62e8051ef8beb87bc34d1d9134e31a084eb6de856216d1
6
+ metadata.gz: 21a03fe45c6afdc8726e1672744922fe1adf9cbe2d0d893d8465512e70e80dd94cc3c3156e2abfd2768d2dc641e7e52a187cae7d3d44ce250ce31c26e65492bd
7
+ data.tar.gz: 15274f194545e8360d9a543e40ea2ffa3debf97f732b0640a1470b003ec767937712cd1c0adf123eca9cd951e399c16597c7887f49303d80a8ae19928a780110
data/.gitignore CHANGED
@@ -16,3 +16,5 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  .DS_Store
19
+ .ruby-gemset
20
+ .ruby-version
@@ -0,0 +1,5 @@
1
+ Metrics/LineLength:
2
+ Enabled: false
3
+ Documentation:
4
+ Enabled: false
5
+
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.0
4
+ addons:
5
+ code_climate:
6
+ repo_token: cd03a3905d9837bf65f9747b8dfacbc31ae8d47ceda70f4530e0ef9a545c9d91
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Gem Riot games API wrapper for Ruby - League of Legends
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/riot_lol_api.svg)](http://badge.fury.io/rb/riot_lol_api)
4
+ [![Build Status](https://travis-ci.org/francois-blanchard/riot_lol_api.svg)](https://travis-ci.org/francois-blanchard/riot_lol_api)
5
+ [![Code Climate](https://codeclimate.com/github/francois-blanchard/riot_lol_api/badges/gpa.svg)](https://codeclimate.com/github/francois-blanchard/riot_lol_api)
6
+ [![Issue Count](https://codeclimate.com/github/francois-blanchard/riot_lol_api/badges/issue_count.svg)](https://codeclimate.com/github/francois-blanchard/riot_lol_api)
7
+ [![Test Coverage](https://codeclimate.com/github/francois-blanchard/riot_lol_api/badges/coverage.svg)](https://codeclimate.com/github/francois-blanchard/riot_lol_api/coverage)
4
8
 
5
9
  ```
6
10
  __________.__ __ _____ __________.___
@@ -17,6 +21,7 @@
17
21
 
18
22
  ```
19
23
  - champion-v1.2 NO IMPLEMENT
24
+ - championmastery OK
20
25
  - current-game-v1.0 OK
21
26
  - featured-games-v1.0 OK
22
27
  - game-v1.3 OK
@@ -24,7 +29,7 @@
24
29
  - lol-static-data-v1.2 OK
25
30
  - lol-status-v1.0 NO IMPLEMENT
26
31
  - match-v2.2 OK
27
- - matchhistory-v2.2 PROGRESS
32
+ - matchlist-v2.2 PROGRESS
28
33
  - stats-v1.3 OK
29
34
  - summoner-v1.4 OK
30
35
  - team-v2.4 NO IMPLEMENT
@@ -54,11 +59,11 @@ Get token api on [http://developer.riotgames.com/](http://developer.riotgames.co
54
59
  ###2) Scripts
55
60
  Sample scripts
56
61
  ```ruby
57
- # Set token
58
- RiotLolApi::TOKEN = XXXXXXXXXXXXXXXXXXXXXXXXXXXX
59
-
60
62
  # Create client
61
- client = RiotLolApi::Client.new(:region => 'your_region')
63
+ client = RiotLolApi::Client.new do |config|
64
+ config.region = 'your_region'
65
+ config.api_key = 'xxxxxxxxxxxx'
66
+ end
62
67
 
63
68
  # Start get data
64
69
  summoner = client.get_summoner_by_name 'your_summoner_name'
@@ -85,7 +90,7 @@ client.get_rune_by_id id, {:version => num_version, :runeListData => 'all'}, 'fr
85
90
  client.get_all_runes {:version => num_version, :runeListData => 'all'}, 'fr_FR'
86
91
  client.get_summoner_spell_by_id id, {:version => num_version, :spellData => 'all'}, 'fr_FR'
87
92
  client.get_all_summoner_spells {:version => num_version, :spellData => 'all'}, 'false', 'fr_FR'
88
- client.get_versions
93
+ client.versions
89
94
 
90
95
  ############
91
96
  # SUMMONER #
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -3,193 +3,213 @@ API_KEY = ARGV[0]
3
3
 
4
4
  # Tab files
5
5
  TAB_CALLS = [
6
+ # championmastery
7
+ {
8
+ url: 'euw.api.pvp.net/championmastery/location/EUW1/player/20639710/champion/89',
9
+ filename: 'championmastery_by_summoner_by_champion',
10
+ params: nil
11
+ },
12
+ {
13
+ url: 'euw.api.pvp.net/championmastery/location/EUW1/player/20639710/champions',
14
+ filename: 'championmastery_by_summoner',
15
+ params: nil
16
+ },
17
+ {
18
+ url: 'euw.api.pvp.net/championmastery/location/EUW1/player/20639710/score',
19
+ filename: 'championmastery_score',
20
+ params: nil
21
+ },
22
+ {
23
+ url: 'euw.api.pvp.net/championmastery/location/EUW1/player/20639710/topchampions',
24
+ filename: 'championmastery_top',
25
+ params: nil
26
+ },
6
27
  # game-v1.3
7
28
  {
8
- :url => "euw.api.pvp.net/api/lol/euw/v1.3/game/by-summoner/20639710/recent",
9
- :filename => "get_summoner_games_by_id",
10
- :params => nil
29
+ url: 'euw.api.pvp.net/api/lol/euw/v1.3/game/by-summoner/20639710/recent',
30
+ filename: 'get_summoner_games_by_id',
31
+ params: nil
11
32
  },
12
33
  # league-v2.5
13
34
  {
14
- :url => "euw.api.pvp.net/api/lol/euw/v2.5/league/by-summoner/20639710/entry",
15
- :filename => "get_player_league",
16
- :params => nil
35
+ url: 'euw.api.pvp.net/api/lol/euw/v2.5/league/by-summoner/20639710/entry',
36
+ filename: 'get_player_league',
37
+ params: nil
17
38
  },
18
39
  # lol-static-data-v1.2
19
40
  {
20
- :url => "global.api.pvp.net/api/lol/static-data/euw/v1.2/champion",
21
- :filename => "get_all_champions_by_ids",
22
- :params => {
23
- :locale => 'fr_FR'
24
- }
41
+ url: 'global.api.pvp.net/api/lol/static-data/euw/v1.2/champion',
42
+ filename: 'get_all_champions_by_ids',
43
+ params: {
44
+ locale: 'fr_FR'
45
+ }
25
46
  },
26
47
  {
27
- :url => "global.api.pvp.net/api/lol/static-data/euw/v1.2/champion",
28
- :filename => "get_all_champions_by_ids_all_data",
29
- :params => {
30
- :locale => 'fr_FR',
31
- :champData => 'all'
32
- }
48
+ url: 'global.api.pvp.net/api/lol/static-data/euw/v1.2/champion',
49
+ filename: 'get_all_champions_by_ids_all_data',
50
+ params: {
51
+ locale: 'fr_FR',
52
+ champData: 'all'
53
+ }
33
54
  },
34
55
  {
35
- :url => "global.api.pvp.net/api/lol/static-data/euw/v1.2/champion/412",
36
- :filename => "get_champion_by_id",
37
- :params => {
38
- :locale => 'fr_FR'
56
+ url: 'global.api.pvp.net/api/lol/static-data/euw/v1.2/champion/412',
57
+ filename: 'get_champion_by_id',
58
+ params: {
59
+ locale: 'fr_FR'
39
60
  }
40
61
  },
41
62
  {
42
- :url => "global.api.pvp.net/api/lol/static-data/euw/v1.2/champion/412",
43
- :filename => "get_champion_by_id_all_data",
44
- :params => {
45
- :locale => 'fr_FR',
46
- :champData => 'all'
63
+ url: 'global.api.pvp.net/api/lol/static-data/euw/v1.2/champion/412',
64
+ filename: 'get_champion_by_id_all_data',
65
+ params: {
66
+ locale: 'fr_FR',
67
+ champData: 'all'
47
68
  }
48
69
  },
49
70
  {
50
- :url => "global.api.pvp.net/api/lol/static-data/euw/v1.2/item",
51
- :filename => "get_all_item",
52
- :params => {
53
- :locale => 'fr_FR',
54
- :itemListData => 'all'
55
- }
71
+ url: 'global.api.pvp.net/api/lol/static-data/euw/v1.2/item',
72
+ filename: 'get_all_item',
73
+ params: {
74
+ locale: 'fr_FR',
75
+ itemListData: 'all'
76
+ }
56
77
  },
57
78
  {
58
- :url => "global.api.pvp.net/api/lol/static-data/euw/v1.2/item/2009",
59
- :filename => "get_item_by_id",
60
- :params => {
61
- :locale => 'fr_FR',
62
- :itemData => 'all'
63
- }
79
+ url: 'global.api.pvp.net/api/lol/static-data/euw/v1.2/item/2009',
80
+ filename: 'get_item_by_id',
81
+ params: {
82
+ locale: 'fr_FR',
83
+ itemData: 'all'
84
+ }
64
85
  },
65
86
  {
66
- :url => "global.api.pvp.net/api/lol/static-data/euw/v1.2/mastery",
67
- :filename => "get_all_masteries",
68
- :params => {
69
- :locale => 'fr_FR',
70
- :masteryListData => 'all'
87
+ url: 'global.api.pvp.net/api/lol/static-data/euw/v1.2/mastery',
88
+ filename: 'get_all_masteries',
89
+ params: {
90
+ locale: 'fr_FR',
91
+ masteryListData: 'all'
71
92
  }
72
93
  },
73
94
  {
74
- :url => "global.api.pvp.net/api/lol/static-data/euw/v1.2/mastery/4353",
75
- :filename => "get_mastery_by_id",
76
- :params => {
77
- :locale => 'fr_FR',
78
- :masteryData => 'all'
95
+ url: 'global.api.pvp.net/api/lol/static-data/euw/v1.2/mastery/6363',
96
+ filename: 'get_mastery_by_id',
97
+ params: {
98
+ locale: 'fr_FR',
99
+ masteryData: 'all'
79
100
  }
80
101
  },
81
102
  {
82
- :url => "global.api.pvp.net/api/lol/static-data/euw/v1.2/realm",
83
- :filename => "get_realm",
84
- :params => nil
103
+ url: 'global.api.pvp.net/api/lol/static-data/euw/v1.2/realm',
104
+ filename: 'realm',
105
+ params: nil
85
106
  },
86
107
  {
87
- :url => "global.api.pvp.net/api/lol/static-data/euw/v1.2/rune",
88
- :filename => "get_all_runes",
89
- :params => {
90
- :locale => 'fr_FR',
91
- :runeListData => 'all'
108
+ url: 'global.api.pvp.net/api/lol/static-data/euw/v1.2/rune',
109
+ filename: 'get_all_runes',
110
+ params: {
111
+ locale: 'fr_FR',
112
+ runeListData: 'all'
92
113
  }
93
114
  },
94
115
  {
95
- :url => "global.api.pvp.net/api/lol/static-data/euw/v1.2/rune/5235",
96
- :filename => "get_rune_by_id",
97
- :params => {
98
- :locale => 'fr_FR',
99
- :runeData => 'all'
116
+ url: 'global.api.pvp.net/api/lol/static-data/euw/v1.2/rune/5235',
117
+ filename: 'get_rune_by_id',
118
+ params: {
119
+ locale: 'fr_FR',
120
+ runeData: 'all'
100
121
  }
101
122
  },
102
123
  {
103
- :url => "global.api.pvp.net/api/lol/static-data/euw/v1.2/summoner-spell",
104
- :filename => "get_all_summoner_spells",
105
- :params => {
106
- :locale => 'fr_FR',
107
- :dataById => 'false',
108
- :spellData => 'all'
124
+ url: 'global.api.pvp.net/api/lol/static-data/euw/v1.2/summoner-spell',
125
+ filename: 'get_all_summoner_spells',
126
+ params: {
127
+ locale: 'fr_FR',
128
+ dataById: 'false',
129
+ spellData: 'all'
109
130
  }
110
131
  },
111
132
  {
112
- :url => "global.api.pvp.net/api/lol/static-data/euw/v1.2/summoner-spell",
113
- :filename => "get_all_summoner_spells_by_ids",
114
- :params => {
115
- :locale => 'fr_FR',
116
- :dataById => 'true',
117
- :spellData => 'all'
133
+ url: 'global.api.pvp.net/api/lol/static-data/euw/v1.2/summoner-spell',
134
+ filename: 'get_all_summoner_spells_by_ids',
135
+ params: {
136
+ locale: 'fr_FR',
137
+ dataById: 'true',
138
+ spellData: 'all'
118
139
  }
119
140
  },
120
141
  {
121
- :url => "global.api.pvp.net/api/lol/static-data/euw/v1.2/summoner-spell/17",
122
- :filename => "get_summoner_spell_by_id",
123
- :params => {
124
- :locale => 'fr_FR',
125
- :spellData => 'all'
142
+ url: 'global.api.pvp.net/api/lol/static-data/euw/v1.2/summoner-spell/1',
143
+ filename: 'get_summoner_spell_by_id',
144
+ params: {
145
+ locale: 'fr_FR',
146
+ spellData: 'all'
126
147
  }
127
148
  },
128
149
  {
129
- :url => "global.api.pvp.net/api/lol/static-data/euw/v1.2/versions",
130
- :filename => "get_version",
131
- :params => nil
150
+ url: 'global.api.pvp.net/api/lol/static-data/euw/v1.2/versions',
151
+ filename: 'get_version',
152
+ params: nil
132
153
  },
133
154
  # match-v2.2
134
155
  {
135
156
  # A faire
136
- :url => "euw.api.pvp.net/api/lol/euw/v2.2/match/1617870200",
137
- :filename => "get_match_by_id",
138
- :params => nil
157
+ url: 'euw.api.pvp.net/api/lol/euw/v2.2/match/1617870200',
158
+ filename: 'get_match_by_id',
159
+ params: nil
139
160
  },
140
- # matchhistory-v2.2
161
+ # matchlist-v2.2
141
162
  {
142
- # A faire
143
- :url => "euw.api.pvp.net/api/lol/euw/v2.2/matchhistory/20639710",
144
- :filename => "get_match_history",
145
- :params => nil
163
+ url: 'euw.api.pvp.net/api/lol/euw/v2.2/matchlist/by-summoner/20639710',
164
+ filename: 'match_list',
165
+ params: nil
146
166
  },
147
167
  # stats-v1.3
148
168
  {
149
- :url => "euw.api.pvp.net/api/lol/euw/v1.3/stats/by-summoner/20639710/ranked",
150
- :filename => "get_player_stat_ranked",
151
- :params => {
152
- :season => 'SEASON2015'
169
+ url: 'euw.api.pvp.net/api/lol/euw/v1.3/stats/by-summoner/20639710/ranked',
170
+ filename: 'get_player_stat_ranked',
171
+ params: {
172
+ season: 'SEASON2015'
153
173
  }
154
174
  },
155
175
  {
156
- :url => "euw.api.pvp.net/api/lol/euw/v1.3/stats/by-summoner/20639710/summary",
157
- :filename => "get_player_stat_summaries",
158
- :params => {
159
- :season => 'SEASON2015'
176
+ url: 'euw.api.pvp.net/api/lol/euw/v1.3/stats/by-summoner/20639710/summary',
177
+ filename: 'get_player_stat_summaries',
178
+ params: {
179
+ season: 'SEASON2015'
160
180
  }
161
181
  },
162
182
  # summoner-v1.4
163
183
  {
164
- :url => "euw.api.pvp.net/api/lol/euw/v1.4/summoner/by-name/pacoloco",
165
- :filename => "summoner",
166
- :params => nil
184
+ url: 'euw.api.pvp.net/api/lol/euw/v1.4/summoner/by-name/pacoloco',
185
+ filename: 'summoner',
186
+ params: nil
167
187
  },
168
188
  {
169
- :url => "euw.api.pvp.net/api/lol/euw/v1.4/summoner/by-name/pacoloco",
170
- :filename => "get_summoner_by_name",
171
- :params => nil
189
+ url: 'euw.api.pvp.net/api/lol/euw/v1.4/summoner/by-name/pacoloco',
190
+ filename: 'get_summoner_by_name',
191
+ params: nil
172
192
  },
173
193
  {
174
- :url => "euw.api.pvp.net/api/lol/euw/v1.4/summoner/20639710",
175
- :filename => "get_summoner_by_id",
176
- :params => nil
194
+ url: 'euw.api.pvp.net/api/lol/euw/v1.4/summoner/20639710',
195
+ filename: 'get_summoner_by_id',
196
+ params: nil
177
197
  },
178
198
  {
179
- :url => "euw.api.pvp.net/api/lol/euw/v1.4/summoner/20639710/masteries",
180
- :filename => "get_summoner_masteries_by_id",
181
- :params => nil
199
+ url: 'euw.api.pvp.net/api/lol/euw/v1.4/summoner/20639710/masteries',
200
+ filename: 'get_summoner_masteries_by_id',
201
+ params: nil
182
202
  },
183
203
  {
184
- :url => "euw.api.pvp.net/api/lol/euw/v1.4/summoner/20639710/runes",
185
- :filename => "get_summoner_runes_by_id",
186
- :params => nil
204
+ url: 'euw.api.pvp.net/api/lol/euw/v1.4/summoner/20639710/runes',
205
+ filename: 'get_summoner_runes_by_id',
206
+ params: nil
187
207
  },
188
208
  # featured-games-v1.0
189
209
  {
190
- :url => "euw.api.pvp.net/observer-mode/rest/featured",
191
- :filename => "get_featured_games",
192
- :params => nil
210
+ url: 'euw.api.pvp.net/observer-mode/rest/featured',
211
+ filename: 'get_featured_games',
212
+ params: nil
193
213
  }
194
214
  # current-game-v1.0
195
215
  # {
@@ -203,24 +223,23 @@ class Mock
203
223
  attr_accessor :data, :url, :file
204
224
 
205
225
  def format_url
206
- full_url = "https://#{self.data[:url]}"
226
+ full_url = "https://#{data[:url]}"
207
227
  full_url += "\?"
208
- unless self.data[:params].nil?
209
- self.data[:params].each do |key,val|
210
- full_url+= "#{key}\=#{val}"
211
- full_url+= "\&"
228
+ unless data[:params].nil?
229
+ data[:params].each do |key, val|
230
+ full_url += "#{key}\=#{val}"
231
+ full_url += "\&"
212
232
  end
213
233
  end
214
234
  full_url += "api_key\=#{API_KEY}"
215
235
 
216
236
  self.url = full_url
217
- self.file = self.data[:filename]
237
+ self.file = data[:filename]
218
238
  end
219
239
 
220
240
  def call_curl
221
- Kernel.system "curl -is '#{self.url}' > spec/mock_response/#{self.file}.json"
241
+ Kernel.system "curl -is '#{url}' > spec/mock_response/#{file}.json"
222
242
  end
223
-
224
243
  end
225
244
 
226
245
  # List CURL commands