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.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +5 -0
- data/.travis.yml +6 -0
- data/README.md +11 -6
- data/Rakefile +6 -1
- data/curl_import.rb +142 -123
- data/lib/core_ext/hash/riot_lol_api.rb +49 -0
- data/lib/core_ext/string/riot_lol_api.rb +9 -0
- data/lib/riot_lol_api.rb +15 -12
- data/lib/riot_lol_api/clients.rb +58 -325
- data/lib/riot_lol_api/{model/players.rb → concerns/inits.rb} +2 -3
- data/lib/riot_lol_api/helper_classes.rb +2 -5
- data/lib/riot_lol_api/models.rb +5 -3
- data/lib/riot_lol_api/models/aggregated_stats.rb +7 -0
- data/lib/riot_lol_api/models/altimages.rb +7 -0
- data/lib/riot_lol_api/models/banned_champions.rb +7 -0
- data/lib/riot_lol_api/models/bans.rb +7 -0
- data/lib/riot_lol_api/models/blocks.rb +9 -0
- data/lib/riot_lol_api/models/champion_masteries.rb +7 -0
- data/lib/riot_lol_api/models/champions.rb +16 -0
- data/lib/riot_lol_api/models/class_base.rb +7 -0
- data/lib/riot_lol_api/models/creepspermindeltas.rb +7 -0
- data/lib/riot_lol_api/models/csdiffpermindeltas.rb +7 -0
- data/lib/riot_lol_api/models/damagetakendiffpermindeltas.rb +7 -0
- data/lib/riot_lol_api/models/damagetakenpermindeltas.rb +7 -0
- data/lib/riot_lol_api/models/data.rb +7 -0
- data/lib/riot_lol_api/models/effects.rb +7 -0
- data/lib/riot_lol_api/models/entries.rb +7 -0
- data/lib/riot_lol_api/models/fellow_players.rb +7 -0
- data/lib/riot_lol_api/models/game_lists.rb +7 -0
- data/lib/riot_lol_api/models/games.rb +12 -0
- data/lib/riot_lol_api/models/goldpermindeltas.rb +7 -0
- data/lib/riot_lol_api/models/golds.rb +7 -0
- data/lib/riot_lol_api/models/images.rb +17 -0
- data/lib/riot_lol_api/models/infos.rb +7 -0
- data/lib/riot_lol_api/models/items.rb +11 -0
- data/lib/riot_lol_api/models/leagues.rb +10 -0
- data/lib/riot_lol_api/models/leveltips.rb +7 -0
- data/lib/riot_lol_api/{model → models}/maps.rb +4 -7
- data/lib/riot_lol_api/models/masteries.rb +14 -0
- data/lib/riot_lol_api/models/matches.rb +11 -0
- data/lib/riot_lol_api/models/mini_series.rb +7 -0
- data/lib/riot_lol_api/models/observers.rb +7 -0
- data/lib/riot_lol_api/models/pages.rb +11 -0
- data/lib/riot_lol_api/models/participantidentities.rb +7 -0
- data/lib/riot_lol_api/models/participants.rb +7 -0
- data/lib/riot_lol_api/models/passives.rb +9 -0
- data/lib/riot_lol_api/models/player_stat_ranks.rb +9 -0
- data/lib/riot_lol_api/models/player_stat_summaries.rb +9 -0
- data/lib/riot_lol_api/models/players.rb +7 -0
- data/lib/riot_lol_api/models/recommendeds.rb +9 -0
- data/lib/riot_lol_api/models/runes.rb +7 -0
- data/lib/riot_lol_api/models/skins.rb +7 -0
- data/lib/riot_lol_api/models/slots.rb +9 -0
- data/lib/riot_lol_api/models/spells.rb +12 -0
- data/lib/riot_lol_api/{model → models}/stats.rb +3 -10
- data/lib/riot_lol_api/models/summoners.rb +110 -0
- data/lib/riot_lol_api/models/teams.rb +11 -0
- data/lib/riot_lol_api/models/timelines.rb +9 -0
- data/lib/riot_lol_api/models/vars.rb +7 -0
- data/lib/riot_lol_api/models/xpdiffpermindeltas.rb +7 -0
- data/lib/riot_lol_api/models/xppermindeltas.rb +7 -0
- data/lib/riot_lol_api/requests/champion_masteries.rb +11 -0
- data/lib/riot_lol_api/requests/champions.rb +23 -0
- data/lib/riot_lol_api/requests/games.rb +23 -0
- data/lib/riot_lol_api/requests/items.rb +23 -0
- data/lib/riot_lol_api/requests/masteries.rb +23 -0
- data/lib/riot_lol_api/requests/runes.rb +23 -0
- data/lib/riot_lol_api/requests/spells.rb +23 -0
- data/lib/riot_lol_api/requests/summoners.rb +29 -0
- data/lib/riot_lol_api/supports/regions.rb +33 -0
- data/lib/riot_lol_api/version.rb +1 -1
- data/riot_lol_api.gemspec +19 -16
- data/spec/factories/champion.rb +8 -8
- data/spec/factories/client.rb +7 -5
- data/spec/factories/game.rb +18 -18
- data/spec/factories/page.rb +8 -8
- data/spec/factories/summoner.rb +10 -9
- data/spec/mock_response/championmastery_by_summoner.json +7 -0
- data/spec/mock_response/championmastery_by_summoner_by_champion.json +7 -0
- data/spec/mock_response/championmastery_score.json +7 -0
- data/spec/mock_response/championmastery_top.json +7 -0
- data/spec/mock_response/get_all_champions_by_ids.json +4 -5
- data/spec/mock_response/get_all_champions_by_ids_all_data.json +4 -5
- data/spec/mock_response/get_all_item.json +4 -5
- data/spec/mock_response/get_all_masteries.json +5 -6
- data/spec/mock_response/get_all_runes.json +4 -5
- data/spec/mock_response/get_all_summoner_spells.json +5 -6
- data/spec/mock_response/get_all_summoner_spells_by_ids.json +4 -5
- data/spec/mock_response/get_champion_by_id.json +3 -4
- data/spec/mock_response/get_champion_by_id_all_data.json +4 -5
- data/spec/mock_response/get_featured_games.json +7 -7
- data/spec/mock_response/get_item_by_id.json +5 -6
- data/spec/mock_response/get_mastery_by_id.json +5 -6
- data/spec/mock_response/get_match_by_id.json +4 -5
- data/spec/mock_response/get_player_league.json +5 -6
- data/spec/mock_response/get_player_stat_ranked.json +5 -6
- data/spec/mock_response/get_player_stat_summaries.json +5 -6
- data/spec/mock_response/get_realm.json +5 -5
- data/spec/mock_response/get_rune_by_id.json +4 -5
- data/spec/mock_response/get_summoner_by_id.json +5 -6
- data/spec/mock_response/get_summoner_by_name.json +5 -6
- data/spec/mock_response/get_summoner_games_by_id.json +5 -6
- data/spec/mock_response/get_summoner_masteries_by_id.json +5 -6
- data/spec/mock_response/get_summoner_runes_by_id.json +5 -6
- data/spec/mock_response/get_summoner_spell_by_id.json +5 -6
- data/spec/mock_response/get_version.json +5 -6
- data/spec/mock_response/match_list.json +12 -0
- data/spec/mock_response/realm.json +12 -0
- data/spec/mock_response/summoner.json +5 -6
- data/spec/{riot_lol_api_spec.rb → riot_lol_api/riot_lol_api_spec.rb} +135 -164
- data/spec/riot_lol_api/riot_lol_api_supports_spec.rb +8 -0
- data/spec/spec_helper.rb +7 -2
- metadata +144 -77
- data/lib/core_ext/hash.rb +0 -29
- data/lib/core_ext/string.rb +0 -5
- data/lib/riot_lol_api/model/aggregated_stats.rb +0 -14
- data/lib/riot_lol_api/model/altimages.rb +0 -14
- data/lib/riot_lol_api/model/banned_champions.rb +0 -14
- data/lib/riot_lol_api/model/bans.rb +0 -14
- data/lib/riot_lol_api/model/blocks.rb +0 -16
- data/lib/riot_lol_api/model/champions.rb +0 -23
- data/lib/riot_lol_api/model/class_base.rb +0 -14
- data/lib/riot_lol_api/model/creepspermindeltas.rb +0 -14
- data/lib/riot_lol_api/model/csdiffpermindeltas.rb +0 -14
- data/lib/riot_lol_api/model/damagetakendiffpermindeltas.rb +0 -13
- data/lib/riot_lol_api/model/damagetakenpermindeltas.rb +0 -14
- data/lib/riot_lol_api/model/data.rb +0 -14
- data/lib/riot_lol_api/model/effects.rb +0 -14
- data/lib/riot_lol_api/model/entries.rb +0 -14
- data/lib/riot_lol_api/model/fellow_players.rb +0 -14
- data/lib/riot_lol_api/model/game_lists.rb +0 -14
- data/lib/riot_lol_api/model/games.rb +0 -19
- data/lib/riot_lol_api/model/goldpermindeltas.rb +0 -14
- data/lib/riot_lol_api/model/golds.rb +0 -14
- data/lib/riot_lol_api/model/images.rb +0 -24
- data/lib/riot_lol_api/model/infos.rb +0 -14
- data/lib/riot_lol_api/model/items.rb +0 -18
- data/lib/riot_lol_api/model/leagues.rb +0 -17
- data/lib/riot_lol_api/model/leveltips.rb +0 -14
- data/lib/riot_lol_api/model/masteries.rb +0 -30
- data/lib/riot_lol_api/model/matches.rb +0 -18
- data/lib/riot_lol_api/model/mini_series.rb +0 -14
- data/lib/riot_lol_api/model/observers.rb +0 -14
- data/lib/riot_lol_api/model/pages.rb +0 -18
- data/lib/riot_lol_api/model/participantidentities.rb +0 -13
- data/lib/riot_lol_api/model/participants.rb +0 -14
- data/lib/riot_lol_api/model/passives.rb +0 -16
- data/lib/riot_lol_api/model/player_stat_ranks.rb +0 -16
- data/lib/riot_lol_api/model/player_stat_summaries.rb +0 -16
- data/lib/riot_lol_api/model/recommendeds.rb +0 -16
- data/lib/riot_lol_api/model/runes.rb +0 -14
- data/lib/riot_lol_api/model/skins.rb +0 -14
- data/lib/riot_lol_api/model/slots.rb +0 -16
- data/lib/riot_lol_api/model/spells.rb +0 -19
- data/lib/riot_lol_api/model/summoners.rb +0 -160
- data/lib/riot_lol_api/model/teams.rb +0 -18
- data/lib/riot_lol_api/model/timelines.rb +0 -16
- data/lib/riot_lol_api/model/vars.rb +0 -14
- data/lib/riot_lol_api/model/xpdiffpermindeltas.rb +0 -14
- data/lib/riot_lol_api/model/xppermindeltas.rb +0 -14
- data/spec/mock_response/get_match_history.json +0 -13
@@ -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
|
-
|
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 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
|