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
@@ -0,0 +1,9 @@
1
+ require 'riot_lol_api/models/blocks'
2
+
3
+ module RiotLolApi
4
+ module Model
5
+ class Recommended
6
+ include RiotLolApi::Concern::Init
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class Rune
4
+ include RiotLolApi::Concern::Init
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class Skin
4
+ include RiotLolApi::Concern::Init
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class Slot
4
+ # attr :id_slot, :rank
5
+
6
+ include RiotLolApi::Concern::Init
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ require 'riot_lol_api/models/leveltips'
2
+ require 'riot_lol_api/models/images'
3
+ require 'riot_lol_api/models/vars'
4
+ require 'riot_lol_api/models/altimages'
5
+
6
+ module RiotLolApi
7
+ module Model
8
+ class Spell
9
+ include RiotLolApi::Concern::Init
10
+ end
11
+ end
12
+ end
@@ -1,17 +1,10 @@
1
1
  module RiotLolApi
2
2
  module Model
3
3
  class Stat
4
-
5
- # attr
4
+ # attr
6
5
  # :totalDamageDealtToChampions :goldEarned :item2 :item1 :wardPlaced :totalDamageTaken :item0 :physicalDamageDealtPlayer :totalUnitsHealed :level :magicDamageDealtToChampions :magicDamageDealtPlayer :assists :magicDamageTaken :numDeaths :totalTimeCrowdControlDealt :physicalDamageTaken :win :team :sightWardsBought :totalDamageDealt :totalHeal :item4 :item3 :item6 :minionsKilled :timePlayed :physicalDamageDealtToChampions :trueDamageTaken :goldSpent
7
6
 
8
- def initialize(options = {})
9
- options.each do |key, value|
10
- self.class.send(:attr_accessor, key.to_sym)
11
- instance_variable_set("@#{key}", value)
12
- end
13
- end
14
-
7
+ include RiotLolApi::Concern::Init
15
8
  end
16
9
  end
17
- end
10
+ end
@@ -0,0 +1,110 @@
1
+ require 'riot_lol_api/models/player_stat_summaries'
2
+ require 'riot_lol_api/models/player_stat_ranks'
3
+ require 'riot_lol_api/models/pages'
4
+ require 'riot_lol_api/models/games'
5
+ require 'riot_lol_api/models/leagues'
6
+ require 'riot_lol_api/models/matches'
7
+ require 'riot_lol_api/models/participants'
8
+ require 'riot_lol_api/models/timelines'
9
+ require 'riot_lol_api/models/creepspermindeltas'
10
+ require 'riot_lol_api/models/xppermindeltas'
11
+ require 'riot_lol_api/models/goldpermindeltas'
12
+ require 'riot_lol_api/models/csdiffpermindeltas'
13
+ require 'riot_lol_api/models/xpdiffpermindeltas'
14
+ require 'riot_lol_api/models/damagetakenpermindeltas'
15
+ require 'riot_lol_api/models/damagetakendiffpermindeltas'
16
+ require 'riot_lol_api/models/participantidentities'
17
+ require 'riot_lol_api/models/players'
18
+ require 'riot_lol_api/models/observers'
19
+ require 'riot_lol_api/models/game_lists'
20
+ require 'riot_lol_api/models/banned_champions'
21
+ require 'riot_lol_api/models/teams'
22
+ require 'riot_lol_api/models/bans'
23
+
24
+ module RiotLolApi
25
+ module Model
26
+ class Summoner
27
+ include RiotLolApi::HelperClass
28
+
29
+ # attr needs @id, @region
30
+ SEASON_TAB = %(SEASON2016, SEASON2015, SEASON2014, SEASON3)
31
+ include RiotLolApi::Concern::Init
32
+
33
+ def masteries
34
+ response = @client.get(url: "#{@region}/v1.4/summoner/#{@id}/masteries", domaine: @region)
35
+ return nil if response.nil?
36
+ tab_pages = []
37
+ response[id.to_s]['pages'].each do |page|
38
+ tab_pages << RiotLolApi::Model::Page.new(page.lol_symbolize)
39
+ end
40
+ tab_pages
41
+ end
42
+
43
+ def runes
44
+ response = @client.get(url: "#{@region}/v1.4/summoner/#{@id}/runes", domaine: @region)
45
+ return nil if response.nil?
46
+ tab_pages = []
47
+ response[id.to_s]['pages'].each do |page|
48
+ tab_pages << RiotLolApi::Model::Page.new(page.lol_symbolize)
49
+ end
50
+ tab_pages
51
+ end
52
+
53
+ def games
54
+ response = @client.get(url: "#{@region}/v1.3/game/by-summoner/#{@id}/recent", domaine: @region)
55
+ return nil if response.nil?
56
+ tab_games = []
57
+ response['games'].each do |game|
58
+ tab_games << RiotLolApi::Model::Game.new(game.lol_symbolize)
59
+ end
60
+ tab_games
61
+ end
62
+
63
+ def stat_summaries(season = 'SEASON2015')
64
+ response = @client.get(url: "#{@region}/v1.3/stats/by-summoner/#{@id}/summary", domaine: @region, data: { season: season })
65
+ return nil if response.nil?
66
+ tab_stat_summaries = []
67
+ response['playerStatSummaries'].each do |stat_summary|
68
+ tab_stat_summaries << RiotLolApi::Model::PlayerStatSummary.new(stat_summary.lol_symbolize)
69
+ end
70
+ tab_stat_summaries
71
+ end
72
+
73
+ def stat_ranks(season = 'SEASON2015')
74
+ response = @client.get(url: "#{@region}/v1.3/stats/by-summoner/#{@id}/ranked", domaine: @region, data: { season: season })
75
+ return nil if response.nil?
76
+ tab_stat_ranks = []
77
+ response['champions'].each do |stat_rank|
78
+ tab_stat_ranks << RiotLolApi::Model::PlayerStatRank.new(stat_rank.lol_symbolize)
79
+ end
80
+ tab_stat_ranks
81
+ end
82
+
83
+ def get_league_stats
84
+ response = @client.get(url: "#{@region}/v2.5/league/by-summoner/#{@id}/entry", domaine: @region)
85
+ return nil if response.nil?
86
+ tab_league_stats = []
87
+ response["#{@id}"].each do |league_stat|
88
+ tab_league_stats << RiotLolApi::Model::League.new(league_stat.lol_symbolize)
89
+ end
90
+ tab_league_stats
91
+ end
92
+
93
+ def match_list
94
+ response = @client.get(url: "#{@region}/v2.2/matchlist/by-summoner/#{@id}", domaine: @region)
95
+ return nil if response.nil?
96
+ response['matches'].map { |match_history| RiotLolApi::Model::Match.new(match_history.lol_symbolize) }
97
+ end
98
+
99
+ def current_game(platform_id = 'EUW1')
100
+ response = @client.get(url: "observer-mode/rest/consumer/getSpectatorGameInfo/#{platform_id}/#{@id}", domaine: @region, overide_base_uri: 'api.pvp.net/')
101
+ return nil if response.nil?
102
+ RiotLolApi::Model::Game.new(response.lol_symbolize)
103
+ end
104
+
105
+ def profile_icon
106
+ "#{RiotLolApi::Client.realm['cdn']}/#{RiotLolApi::Client.realm['v']}/img/profileicon/#{profile_icon_id}.png"
107
+ end
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,11 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class Team
4
+ include RiotLolApi::Concern::Init
5
+
6
+ def win?
7
+ winner
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class Timeline
4
+ # attr :id_slot, :rank
5
+
6
+ include RiotLolApi::Concern::Init
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class Var
4
+ include RiotLolApi::Concern::Init
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class XpDiffPerMinDelta
4
+ include RiotLolApi::Concern::Init
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class XpPerMinDelta
4
+ include RiotLolApi::Concern::Init
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ module RiotLolApi
2
+ module Request
3
+ module ChampionMastery
4
+ def championmastery_by_summoner_by_champion(summoner_id:, champion_id:)
5
+ response = get(url: "championmastery/location/#{@platform}/player/#{summoner_id}/champion/#{champion_id}", domaine: @region, overide_base_uri: 'api.pvp.net/')
6
+ return nil if response.nil?
7
+ RiotLolApi::Model::ChampionMastery.new(response.lol_symbolize)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,23 @@
1
+ module RiotLolApi
2
+ module Request
3
+ module Champion
4
+ def get_champion_by_id(id, data = {}, locale = 'en_US')
5
+ data.merge!(locale: locale)
6
+ response = get(url: "static-data/#{@region}/v1.2/champion/#{id}", domaine: 'global', data: data)
7
+ return nil if response.nil?
8
+ RiotLolApi::Model::Champion.new(response.lol_symbolize)
9
+ end
10
+
11
+ def get_all_champions(data = {}, sort_id = 'false', locale = 'en_US')
12
+ data.merge!(locale: locale, dataById: sort_id)
13
+ response = get(url: "static-data/#{@region}/v1.2/champion", domaine: 'global', data: data)
14
+ return nil if response.nil?
15
+ tab_champions = []
16
+ response['data'].each do |champion|
17
+ tab_champions << RiotLolApi::Model::Champion.new(champion[1].lol_symbolize)
18
+ end
19
+ tab_champions
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ module RiotLolApi
2
+ module Request
3
+ module Game
4
+ def featured_games
5
+ response = get(url: 'observer-mode/rest/featured', domaine: @region, overide_base_uri: 'api.pvp.net/')
6
+ return nil if response.nil?
7
+ RiotLolApi::Model::Observer.new(response.lol_symbolize)
8
+ end
9
+
10
+ def current_game(summoner_id, platform_id = 'EUW1')
11
+ response = get(url: "observer-mode/rest/consumer/getSpectatorGameInfo/#{platform_id}/#{summoner_id}", domaine: @region, overide_base_uri: 'api.pvp.net/')
12
+ return nil if response.nil?
13
+ RiotLolApi::Model::Game.new(response.lol_symbolize)
14
+ end
15
+
16
+ def match(game_id)
17
+ response = get(url: "#{@region}/v2.2/match/#{game_id}", domaine: @region)
18
+ return nil if response.nil?
19
+ RiotLolApi::Model::Match.new(response.lol_symbolize)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ module RiotLolApi
2
+ module Request
3
+ module Item
4
+ def get_all_items(data = {}, locale = 'en_US')
5
+ data.merge!(locale: locale)
6
+ response = get(url: "static-data/#{@region}/v1.2/item", domaine: 'global', data: data)
7
+ return nil if response.nil?
8
+ tab_items = []
9
+ response['data'].each do |item|
10
+ tab_items << RiotLolApi::Model::Item.new(item[1].lol_symbolize)
11
+ end
12
+ tab_items
13
+ end
14
+
15
+ def get_item_by_id(id, data = {}, locale = 'en_US')
16
+ data.merge!(locale: locale)
17
+ response = get(url: "static-data/#{@region}/v1.2/item/#{id}", domaine: 'global', data: data)
18
+ return nil if response.nil?
19
+ RiotLolApi::Model::Item.new(response.lol_symbolize)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ module RiotLolApi
2
+ module Request
3
+ module Mastery
4
+ def get_all_masteries(data = nil, locale = 'en_US')
5
+ data.merge!(locale: locale)
6
+ response = get(url: "static-data/#{@region}/v1.2/mastery", domaine: 'global', data: data)
7
+ return nil if response.nil?
8
+ tab_masteries = []
9
+ response['data'].each do |mastery|
10
+ tab_masteries << RiotLolApi::Model::Mastery.new(mastery[1].lol_symbolize.merge(client: self))
11
+ end
12
+ tab_masteries
13
+ end
14
+
15
+ def get_mastery_by_id(id, data = {}, locale = 'en_US')
16
+ data.merge!(locale: locale)
17
+ response = get(url: "static-data/#{@region}/v1.2/mastery/#{id}", domaine: 'global', data: data)
18
+ return nil if response.nil?
19
+ RiotLolApi::Model::Mastery.new(response.lol_symbolize.merge(client: self))
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ module RiotLolApi
2
+ module Request
3
+ module Rune
4
+ def get_all_runes(data = {}, locale = 'en_US')
5
+ data.merge!(locale: locale)
6
+ response = get(url: "static-data/#{@region}/v1.2/rune", domaine: 'global', data: data)
7
+ return nil if response.nil?
8
+ tab_runes = []
9
+ response['data'].each do |rune|
10
+ tab_runes << RiotLolApi::Model::Rune.new(rune[1].lol_symbolize)
11
+ end
12
+ tab_runes
13
+ end
14
+
15
+ def get_rune_by_id(id, data = {}, locale = 'en_US')
16
+ data.merge!(locale: locale)
17
+ response = get(url: "static-data/#{@region}/v1.2/rune/#{id}", domaine: 'global', data: data)
18
+ return nil if response.nil?
19
+ RiotLolApi::Model::Rune.new(response.lol_symbolize)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ module RiotLolApi
2
+ module Request
3
+ module Spell
4
+ def get_all_summoner_spells(data = {}, sort_id = 'false', locale = 'en_US')
5
+ data.merge!(locale: locale, dataById: sort_id)
6
+ response = get(url: "static-data/#{@region}/v1.2/summoner-spell", domaine: 'global', data: data)
7
+ return nil if response.nil?
8
+ tab_summoner_spells = []
9
+ response['data'].each do |summoner_spell|
10
+ tab_summoner_spells << RiotLolApi::Model::Spell.new(summoner_spell[1].lol_symbolize)
11
+ end
12
+ tab_summoner_spells
13
+ end
14
+
15
+ def get_summoner_spell_by_id(id, data = {}, locale = 'en_US')
16
+ data.merge!(locale: locale)
17
+ response = get(url: "static-data/#{@region}/v1.2/summoner-spell/#{id}", domaine: 'global', data: data)
18
+ return nil if response.nil?
19
+ RiotLolApi::Model::Spell.new(response.lol_symbolize)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,29 @@
1
+ module RiotLolApi
2
+ module Request
3
+ module Summoner
4
+ def get_summoner_by_name(name)
5
+ name = name.downcase
6
+ name.strip!
7
+ response = get(url: "#{@region}/v1.4/summoner/by-name/#{name}", domaine: @region)
8
+ return nil if response.nil?
9
+ RiotLolApi::Model::Summoner.new(response[name].lol_symbolize.merge(region: @region, client: self))
10
+ end
11
+
12
+ def get_summoner_by_id(id)
13
+ response = get(url: "#{@region}/v1.4/summoner/#{id}", domaine: @region)
14
+ return nil if response.nil?
15
+ RiotLolApi::Model::Summoner.new(response[id.to_s].lol_symbolize.merge(region: @region, client: self))
16
+ end
17
+
18
+ def get_summoners_by_id(id)
19
+ response = get(url: "#{@region}/v1.4/summoner/#{id}", domaine: @region)
20
+ return nil if response.nil?
21
+ summoners = []
22
+ response.each do |_id, data|
23
+ summoners << RiotLolApi::Model::Summoner.new(response[data['id'].to_s].lol_symbolize.merge(region: @region, client: self))
24
+ end
25
+ summoners
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,33 @@
1
+ module RiotLolApi
2
+ module Support
3
+ class Region
4
+ attr_accessor :region, :platform
5
+ def initialize(region)
6
+ @region = region
7
+ @platform = find_platform
8
+ end
9
+
10
+ def find_platform
11
+ list[@region.to_sym]
12
+ end
13
+
14
+ private
15
+
16
+ def list
17
+ {
18
+ br: 'BR1',
19
+ eune: 'EUNE1',
20
+ euw: 'EUW1',
21
+ kr: 'KR',
22
+ lan: 'LA1',
23
+ las: 'LA2',
24
+ na: 'NA1',
25
+ oce: 'OC',
26
+ ru: 'RU',
27
+ tr: 'TR1'
28
+ }
29
+ end
30
+
31
+ end
32
+ end
33
+ end